问题
On iPhone5 [[UISCreen mainScreen] bounds].size comes back as 320x480. Why. In all the posts I'm reading, people are saying that it returns the correct screen size. What is going on here? Am I missing something in the .plist file or something?
BTW I am hand coding the GUI, so there is no XIB.
回答1:
Unless your app includes a Default-568h.png in it's bundle, it will run inside a 480 point high legacy screen sandbox on the iPhone 5, and can't draw or see any dimensions outside that sandbox.
Note that including this Default-568h.png is only allowed when building an app using Xcode 4.5 and the iOS 6 SDK (or, presumably, later) for submission to Apple's App store.
Added: When building with the iOS 8 SDK (or later) and running the app under iOS 8 (or later), a LaunchScreen.xib will also remove the 480 height sandbox.
回答2:
It would appear that having a launch image in place is a prerequisite to [[UIScreen mainScreen] bounds] working properly on iPhone5. This is an issue for those of us dependent on design teams for our images. It looks like you just have to hack together a launch image and put it in place.
Is there really no better way? Anyone?
来源:https://stackoverflow.com/questions/12752738/on-iphone5-uiscreen-mainscreen-bounds-size-comes-back-as-320x480