2

I created a new project in XCode 5. And I run it on iPhone 5 (which has 4" screen) and a view doesn't cover all screen, but rather squeezed in 3.5" box (there are two black bars around my view)

I went to Main_iPhone.storyboard and checked that:

  • Use Autolayout is turned on on View Contoller
  • Use Autolayout is turned on on View
  • I tried Simulated Metrics, Size: Retina 4-inch Full Screen, Freeform and Inferred.
  • I tried to use button at the button to switch to Retina 4-inch form factor and 3.5-inch form factor.

Nothing makes a difference and it still shown as 3.5" (black bars around my view).

How can I make sure that iPhone storyboard occupies whole screen on iPhone 4-inch phone?

Update 1

None of solutions in this question: Xcode Storyboard displaying the new iPhone 5 screen size? solved my problem. BTW. That question was for pre XCode 5.

Community
  • 1
  • 1
Victor Ronin
  • 22,758
  • 18
  • 92
  • 184

2 Answers2

6

To enable your apps to work with iPhone 5, I suggest you to do two things.

First you need to add a retina version of the launcher image. It should be named Default-568h@2x.png.

And second use Auto Layout and make sure you have your autoresizing mask set up correctly for all your views.

VGruenhagen
  • 1,487
  • 15
  • 28
  • You don't actually need to use AutoLayout. It is possible to support both, iOS 5.x (no AutoLayout available) and 4-inch retina display. – Nero Oct 08 '13 at 21:11
  • You are right, but Autolayout will make it easier to optimize for ios 7 and future updates. Apple is really pushing for apps to use Autolayout. And there is really no reason not to because it will make your code cleaner instead of having to keep track of each case of screen size. iphone, iphone retina, ipad, ipad retina. – VGruenhagen Oct 08 '13 at 21:17
  • Yes, of course it is recommended to use AutoLayout. But it is not mandatory for the 4-inch retina display support and if you'd like to support iOS 5 you can't use it. – Nero Oct 08 '13 at 21:20
0

I had the same problem, could not resolve it by any of the above methods. So what I did is copied the Content.json files from old project (where 4-inch was working) into the Images.xcassets Applcon.appiconset and LaunchImage.launchimage directories respectively. Then selected in the project setting in General under App Icon selected Source as AppIcon and in Launch Images in Source selected LaunchImage. It worked. Maybe useful to someone.

Jayku
  • 51
  • 1
  • 8