本文共 852 字,大约阅读时间需要 2 分钟。
For the UIDevice.h in the iOS SDK, could to fetch more information about the current device. common methods have as follow: 1. Judge the screen is Retina or not. #define isRetina ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO) 2. Judge run on the simulator or not #define isSimulator ([[[UIDevice currentDevice] model] rangeOfString:@”Simulator”].location != NSNotFound) 3. Judge the device is iPad or not (1) if the device version is more than 3.2, so use it: #define isPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) (2) if want to judge at all device version(contain 3.0), should be as this: #define isPad ([[[UIDevice currentDevice] model] rangeOfString:@"iPad"].location != NSNotFound) 转载于:https://my.oschina.net/ahuaahua/blog/41922