How to detect iPhone 5 (widescreen devices)?

前端 未结 24 1275
我寻月下人不归
我寻月下人不归 2020-11-22 00:50

I\'ve just upgraded to XCode 4.5 GM and found out that you can now apply the \'4\" Retina\' size to your view controller in the storyboard.

Now if I want to create a

24条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 01:18

    Used to detect iPhone and iPad Devices of all versons.

    #define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    #define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
    #define IS_IPHONE_5 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 568.0)
    #define IS_IPHONE_6 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 667.0)
    #define IS_IPHONE_6_PLUS (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 736.0)
    #define IS_RETINA ([[UIScreen mainScreen] scale] == 2.0) 
    

提交回复
热议问题