UIScreen MainScreen Bounds returning wrong size

前端 未结 6 2042
半阙折子戏
半阙折子戏 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 04:58

    iOS will often "pretend" what screen size you have. Apple assumes for example that if you don't have the right launch image for some resolution, then you haven't designed your app to work properly in that resolution, so it will run your app in a different size. In an extreme case, an iPhone only app running on an iPad will return 320 x 480.

    As far as your application is concerned, the screen size reported is the screen size available to your application. If it reports 320 x 480 then that is what your application can use. Anything drawn below 480 pixels will not be visible.

    You convince iOS to run your app in the resolution that you want for example by supplying a launch image in the right size. In the case of iPhone 6 and 6+, the user can run them in "Zoom" mode so they behave as if they had the screen of an iPhone 5 or 6 (just physically bigger).

提交回复
热议问题