我的常用宏-IOS

core data

 

获取appDelegate

#define GetAppDelegate  ((AppDelegate *)[[UIApplication sharedApplication] delegate])

获取core data 模版中NSManagedObjectContext

#define GetAppDelegateContext GetAppDelegate.managedObjectContext

判断是否3.5寸屏幕

#define Screen3dot5   CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(320, 480))

判断是否retina屏幕

#define isRetina ([UIScreen mainScreen].scale == 2.0)?YES:NO

判断是否IOS7

#define IOS7 ([[UIDevice currentDevice].systemVersion floatValue]>=7.0f)

将IOS6 searchBar背景透明

if (!IOS7){[[[self.searchDisplayController.searchBar subviews] objectAtIndex:0] setAlpha:0.0f];}

16进制rgb生成color

#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

 

  

posted on 2014-01-14 17:00  永远的冰蝴蝶  阅读(242)  评论(0编辑  收藏  举报

导航