UIScreen MainScreen Bounds returning wrong size

前端 未结 6 2056
半阙折子戏
半阙折子戏 2020-11-29 04:10

So I created a new project with the latest version of XCode and tried to log the screen size of my app (to determine the device type for UI). I ran the following code from m

6条回答
  •  被撕碎了的回忆
    2020-11-29 05:04

    This is still dependent on the launch images as described in the answer posted in 2014.

    Since that answer was posted Apple has released a lot of products with different screen resolutions, so solution #2 in that answer no longer works for all devices.

    As of XCode 10.3, the way to do this is to create a launch image asset catalog in your project and then and populate it with images. Specifically, 27 different launch images of varying sizes for all possible options.

    I made the full set for a project I was working on, these are posted on github so that you can save yourself the fun I had making all these images.

    https://github.com/aeu/ios-launch-images

提交回复
热议问题