Xcode 6 & Swift: Black bars appear above and below the viewcontroller on iOS 7 iPhone 5 device
Asked Answered
L

5

9

I created a single view test app and tried running it on my iPhone 5 with iOS 7 installed. It looks like the screen is set to the iPhone 4 size and black bars appear above and below the view controller. I just created the project with Xcode 6 and tried running it without touching any other settings. Has anybody else seen this?

Laurynlausanne answered 28/9, 2014 at 12:23 Comment(3)
You get this sorted out?Xyloid
Did u get the answer?? all below solutions didn't worked for me.Haemolysin
Pknife's and Austen's solution below worked for me. In images.xcassets > LaunchImage, for iPhone Portrait iOS 7-9, You have to add a 640x960 image to the 2x slot and a 640x1136 image to the Retina 4 slot. That solves it.Indonesian
S
12

In order to solve this problem you have to create launch-screen images for the devices your app supports.

When starting a new app:

For instance let's say your app supports iPhones > 4s, so iPhone: 4s, 5, 5s, 6 and 6plus.

Make sure to make launch-images which have the following dimensions:

  • iPhone4s = 640 × 960
  • iPhone5, 5s = 640 × 1136
  • iPhone6 = 750 x 1134
  • iPhone6plus = 1242 x 2208

For more info about iOS screen dimensions, see this helpful chart

Select your project and then the general settings:

Select or make launch screens in the general section when clicked on your project.

enter image description here

And then make sure you add or select an Launch-image asset: enter image description here

Go to images.xcassets and select LaunchImage at the left, then select the devices your app supports (at the right)

enter image description here

Make sure you put your images on the right spot, you can select the dashed square and see in the attributes inspector (right section on screen) what dimensions your image needs to meet.

Now when simulating your app all black bars have disappeared.

Screens answered 19/11, 2014 at 17:50 Comment(0)
X
8

You need to add a [email protected] launch image. Here is one that I found by googling (I didn't create it and take no credit for it): https://jira.appcelerator.org/secure/attachment/31241/[email protected]

If you want to create your own image its dimensions have to be 640 × 1136. Since you did no customizing the filename should be "[email protected]".

Xyloid answered 28/9, 2014 at 13:0 Comment(1)
how can you get this to work when you want to use the LaunchScreen..xib file as launch screen instead of the images?Mudpack
B
1

For some reason, the default LaunchScreen.xib that comes with a new project on Xcode 6.1 is 480x480, while the standard .xib file size for auto layout and adaptive layout appears to be 600x600. If you set the LaunchScreen.xib view size to 600x600, it should fix the problem, did for me.

Bilocular answered 22/10, 2014 at 20:6 Comment(0)
C
0

Make sure you add a launch image for your device screen size and that will fix your problem.

Churchly answered 28/9, 2014 at 12:36 Comment(0)
M
0

I have had the same issue. In my universal app I configured orientation for iPad and iPhone and forgot to set back devices drop down to Universal (on target general settings screen). When I set it back - screen shows as expected.

Mournful answered 30/11, 2014 at 13:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.