使用宏定義判斷設(shè)備型號(hào)
//判斷是否為iPhone或ipad
#define UI_IS_IPAD? ? ? ? ? ? ? ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
#define UI_IS_IPHONE? ? ? ? ? ? ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
//判斷iPhone型號(hào)
#define UI_IS_IPHONE4? ? ? ? ? (UI_IS_IPHONE && [[UIScreen mainScreen] bounds].size.height < 568.0)
#define UI_IS_IPHONE5? ? ? ? ? (UI_IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 568.0)
#define UI_IS_IPHONE6? ? ? ? ? (UI_IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 667.0)
#define UI_IS_IPHONE6PLUS? ? ? (UI_IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 736.0 || [[UIScreen mainScreen] bounds].size.width == 736.0) // Both orientations
#define UI_IS_IOS8_AND_HIGHER? ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0)
使用時(shí)直接判斷 例如if(UI_IS_IPHONE4)