您的位置:首页 > 移动开发 > IOS开发

我的常用宏-IOS

2014-01-14 17:00 78 查看
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]


  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: