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
- (void)scrollViewDidScroll:(UIScrollView *)scrollView | |
{ | |
CGFloat offsetY = scrollView.contentOffset.y; | |
if (offsetY < 0) { | |
[scrollView setContentOffset:CGPointMake(0, 0) animated:NO]; | |
} | |
} |
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
+ (BOOL)isJailbroken { | |
BOOL jailbroken = NO; | |
NSString *cydiaPath = @"/Applications/Cydia.app"; | |
NSString *aptPath = @"/private/var/lib/apt/"; | |
if ([[NSFileManager defaultManager] fileExistsAtPath:cydiaPath]) { | |
jailbroken = YES; | |
} | |
if ([[NSFileManager defaultManager] fileExistsAtPath:aptPath]) { | |
jailbroken = YES; | |
} |
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
self.tableView.contentInset = UIEdgeInsetsMake(-35, 0, 0, 0); |
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
- (UIViewController *)topViewController{ | |
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController]; | |
} | |
- (UIViewController *)topViewController:(UIViewController *)rootViewController | |
{ | |
if (rootViewController.presentedViewController == nil) { | |
return rootViewController; | |
} | |
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
for (UITabBarItem* item in self.tabBarController.tabBar.items) | |
{ | |
[item setTitlePositionAdjustment:UIOffsetMake(0, -3)]; | |
} |
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
#define ZLDWeak(agWeak,obj) __block __unsafe_unretained typeof (&*obj) agWeak = obj |
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
#define PASS_NULL_TO_NIL (instance)(([instance isKindOfClass:[NSNull class]]) ? nil : instance) |
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 *image = ...; | |
//Have the image draw itself in the correct orientation if necessary | |
if(!(image.imageOrientation == UIImageOrientationUp || | |
image.imageOrientation == UIImageOrientationUpMirrored)) | |
{ | |
CGSize imgsize = image.size; | |
UIGraphicsBeginImageContext(imgsize); | |
[image drawInRect:CGRectMake(0.0, 0.0, imgsize.width, imgsize.height)]; | |
image = 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
-(CGFloat)tableView:(UITableView*)tableView heightForHeaderInSection:(NSInteger)section | |
{ | |
if(section == 0) | |
return 6; | |
return 1.0; | |
} | |
-(CGFloat)tableView:(UITableView*)tableView heightForFooterInSection:(NSInteger)section | |
{ | |
return 5.0; |
OlderNewer