This file contains hidden or 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
BOOL isJailbreak() | |
{ | |
int res = access("/var/mobile/Library/AddressBook/AddressBook.sqlitedb", F_OK); | |
if (res != 0) | |
return NO; | |
return YES; | |
} |
This file contains hidden or 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
unsigned char *getBitmapFromImage(UIImage *image) | |
{ | |
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); | |
if (colorSpace == NULL) { | |
fprintf(stderr, "Error allocating color space\n"); | |
return NULL; | |
} |
This file contains hidden or 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 *)imageFromView:(UIView *)view | |
{ | |
UIGraphicsBeginImageContext(view.frame.size); | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
[view layer] renderInContext:context]; | |
UIImage *image = UIGraphicsGetImageFromImageContext(); | |
UIGraphicsEndImageContext(); | |
return image; | |
} |
This file contains hidden or 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
-(UIView *)findView:(UIView *)view withName:(NSString *)name{ | |
Class cl = [view class]; | |
NSString *desc = [cl description]; | |
if ([desc compare:name] == NSOrderedSame) | |
return view; | |
for (int i = 0; i < [view.subviews count]; i++) | |
{ | |
UIView *subView = [view.subviews objectAtIndex:i]; |
This file contains hidden or 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
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { | |
UIView * previewView = [[[[[[[[[[self.picker.view // UILayoutContainerView | |
subviews] objectAtIndex:0] // UINavigationTransitionView | |
subviews] objectAtIndex:0] // UIViewControllerWrapperView | |
subviews] objectAtIndex:0] // UIView | |
subviews] objectAtIndex:0] // PLCameraView | |
subviews] objectAtIndex:0]; // PLPreviewView | |
[previewView touchesBegan:touches withEvent:event]; | |
} |
NewerOlder