Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

On iPhone5 [[UISCreen mainScreen] bounds].size comes back as 320x480?

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.

like image 814
Brooks Avatar asked Oct 05 '12 19:10

Brooks


2 Answers

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.

like image 181
hotpaw2 Avatar answered Sep 21 '22 12:09

hotpaw2


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?

like image 45
Brooks Avatar answered Sep 22 '22 12:09

Brooks