Why [UIScreen mainScreen].bounds] is not returning full screen size?

ε祈祈猫儿з 提交于 2019-11-27 07:23:17

问题


I have an app that was created prior to the new iPhone 5 retina widescreen device. Now i am trying to support this high definition widescreen.

I adjust the main ViewController and the main window XIB files so that they are set to Autolayout. I can verify that the width/height displayed via the IB shows 320 x 568.

However, when I run in simulator, i can see that the height is still 480. The code im using to print the height (and width) is in the main view controller's viewWillAppear method:

[UIScreen mainScreen].bounds]

Why is the size.height still 480 instead of 568?


回答1:


You have to add the iPhone 5 Launch image (Default-568h@2x.png) to your project.

The 568 point tall launch image tells iOS to launch your app in 4" mode. If you don't have this image, your app is treated as a 3.5" app. Even if it is 4" compatible.




回答2:


Point worth notice - in new Xcode you have to add this image file Default-568h@2x.png to assets



来源:https://stackoverflow.com/questions/17761967/why-uiscreen-mainscreen-bounds-is-not-returning-full-screen-size

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!