iOS How to detect iPhone X, iPhone 6 plus, iPhone 6, iPhone 5, iPhone 4 by macro?

前端 未结 13 687
一整个雨季
一整个雨季 2020-11-28 01:17

How to detect device model by macro? i had using something like this but the result on the simulator alway IS_IPHONE_5

#define IS_IPAD (UI_USER_INTERFACE_IDI         


        
13条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-28 01:51

    I encountered the problem while migrating from an iOS 7 project to a iOS 8 project, since I didn't add a launch screen scene to my project.

    In this case the screen size for iPhone 6 and 6+ are as iPhone 5.

    See from apple documentation; You use a launch XIB or storyboard file to indicate that your app runs on iPhone 6 Plus or iPhone 6.

提交回复
热议问题