码迷,mamicode.com
首页 > 其他好文 > 详细

常用宏定义

时间:2015-04-04 13:45:53      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:

#define kVersionId      [[[NSBundle mainBundle] infoDictionary]objectForKey:@"CFBundleVersion"]          // 版本ID

#define kVersionNumber  [[[NSBundle mainBundle] infoDictionary]objectForKey:@"CFBundleShortVersionString"]    // 版本号

// 屏幕尺寸

#define SCREEN_BOUNDS [[UIScreen mainScreen] bounds]

#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)

#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)


// 颜色设置

#define RGB(A,B,C) [UIColor colorWithRed:A/255.0 green:B/255.0 blue:C/255.0 alpha:1.0]


// 是否高清屏

#define IS_RETINA   ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)

#define IS_IPHONE5  ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)


// 是否模拟器

#if TARGET_IPHONE_SIMULATOR

#define IS_SIMULATOR YES

#else

#define IS_SIMULATOR NO

#endif




// 是否是iPhone

#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)


// 是否iPad

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)


// 是否IOS6

#define IS_IOS6 ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0)


// 是否IOS7

#define IS_IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)


// 4s5s屏大小判断

#define IOS_4S ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)


#define IS_IPHONE4 ([UIScreen mainScreen].bounds.size.height == 480)


常用宏定义

标签:

原文地址:http://my.oschina.net/jilin/blog/396041

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!