判斷設備是否是ipad
BOOL isPad() {
#ifdef UI_USER_INTERFACE_IDIOM
return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
#else
return NO;
#endif
}
判斷設備是否是iphone5
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
判斷當前設備的版本
[[[UIDevice currentDevice] systemVersion] floatValue]
寫成宏
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]