14

I am writing an iPhone app using Xamarin. My UIViewController does not fill the entire screen, there is a gap above and below. Here is a screen shot from the simulator. I have changed the colour scheme to make the gaps more obvious

enter image description here

The screen design was done in Xcode below is a screen shot of the settings for the UIViewController in Xcode.

XCode settings

What am I doing wrong, why is the View too small?

Rajesh
  • 10,318
  • 16
  • 44
  • 64
JDibble
  • 744
  • 1
  • 8
  • 25
  • 1
    You are missing the correct launch screens. – rckoenes Sep 19 '14 at 08:34
  • possible duplicate of [Black bars showing when running app on iOS 7 (4 inch retina display)](http://stackoverflow.com/questions/18913105/black-bars-showing-when-running-app-on-ios-7-4-inch-retina-display) – Rajesh Sep 19 '14 at 08:53

2 Answers2

28

Put a 4" launch screen image into your asset catalog or info.plist

liamnichols
  • 12,419
  • 2
  • 43
  • 62
  • Thanks for your help, I was expecting it to be something simple. – JDibble Sep 19 '14 at 08:49
  • 3
    Can you explain why this is the fix? I am trying to fix this same problem and couldn't figure out where to put my files. – bitops Nov 20 '14 at 05:31
  • 11
    When apple first released the iPhone 5 (4" screen), they needed a way for developers to "tell" the device that their app supported the new 4" screen. Apple's solution was to detect if they had a 4" launch image as this is something that apps already on the store wouldn't have. To avoid breaking every single existing app, if there is no 4" launch image, the app will launch in a letterbox mode where the height of the UIWindow remained at 480pts instead of 586pts. Adding the 4" launch image tells the device that this app is ready for a 4" screen and that it doesn't have to letterbox it. – liamnichols Nov 20 '14 at 09:59
  • 2
    I'm having this problem and have a Retina 4 launch image set but it's not working. Is there a specific size the image needs to be. – mikeLspohn May 20 '15 at 15:29
2

I was having this issue when running my app on an iPhone 7. There was a black bar along the bottom.

I tried following the other answers but the iOS Launch Image is marked as Depricated in Xcode 12.5.1

What solved it for was to add the UILaunchScreen key and empty <dict/> to my Info.plist file like this:

...
<plist·version="1.0"> 
<dict> 
...
    <key>UILaunchScreen</key>
    <dict/>
...
</dict> 
</plist>

If your using xcode to generate your project files this is probably not an issue, but my .xcodeproj and Info.plist are generated by the xcodegen tool which did not add this key-value to my plist.

Chris
  • 2,166
  • 1
  • 24
  • 37