This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
** this is fix for "famous" javax.net.ssl.SSLHandshakeException: | |
** unable to find valid certification path to requested target | |
** it's OK to use this for testing, but not production | |
*/ | |
public static void disableCertificateValidation() { | |
// Create new Trust Manager that will not validate any of the certificate chains | |
TrustManager[] trustAllCerts = new TrustManager[] { | |
new X509TrustManager() { | |
public X509Certificate[] getAcceptedIssuers() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIImage *)drawTextOnImage:(NSString *)text :(UIImage *)img { | |
UIGraphicsBeginImageContext(img.size); | |
CGRect imageBoundaries = CGRectMake(0,0, img.size.width, img.size.height); | |
[img drawInRect:imageBoundaries]; | |
[[UIColor grayColor] set]; | |
[text drawInRect:imageBoundaries withFont:[UIFont boldSystemFontOfSize:15] lineBreakMode:NSLineBreakByTruncatingTail alignment:NSTextAlignmentCenter]; | |
UIImage *theImage=UIGraphicsGetImageFromCurrentImageContext(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <AssetsLibrary/AssetsLibrary.h> | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
void (^assetEnumerator)(ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop) | |
{ | |
if( result != nil) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIImage *)drawTextOnImage:(NSString *)text :(UIImage *)img { | |
UIGraphicsBeginImageContextWithOptions(img.size, NO, [UIScreen mainScreen].scale); | |
CGRect imageBoundaries = CGRectMake(0,0, img.size.width, img.size.height); | |
[img drawInRect:imageBoundaries]; | |
imageBoundaries.origin.y = (imageBoundaries.size.height - 14) / 2 - 4; | |
imageBoundaries = CGRectIntegral(imageBoundaries); | |
imageBoundaries.size.height = 14; | |
[[UIColor grayColor] set]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(IS_IOS_7) { | |
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; | |
self.window.clipsToBounds =YES; | |
self.window.frame = CGRectMake(0, 20, self.window.frame.size.width,self.window.frame.size.height-20); | |
self.window.bounds = CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height); | |
} | |
return YES; |