PassKit
PassKit

Reputation: 12581

Xcode 7 auto layout always renders 4:3 ratio

After upgrading my project from Swift 1.2/Xcode 6 to Swift 2.0/Xcode 7 all of my view controllers are rendering in 4:3 ratio (iPhone <=4). On iPhone <=5 then black space pads the top and the bottom of the screens.

Nothing has changed with the storyboard, and I am not dynamically sizing the views or using any other code to manipulate the view size.

What could be causing this issue, and how to resolve? I have tried a number of hacks including requesting full screen in the info.plist but cannot get it to work. It is frustrating since everything worked perfectly before Xcode7.

Below is a screenshot from an iPhone 6 showing the black space above and below the controller.

enter image description here

Upvotes: 2

Views: 188

Answers (3)

syumai
syumai

Reputation: 36

I resolved it by choosing 'Launch Screen File' as '*.storyboard' from Project Settings -> Targets -> App Icons and Launch Images.

Upvotes: 2

fnc12
fnc12

Reputation: 2237

It happens cause you do not have Launch images properly set.

  1. Go to image assets
  2. Hit + => "App Icons & Launch Images" => "New iOS Launch Image"
  3. Now you created a special image asset for launch image. Open it (it has 'LaunchImage' default name) and specify images for all kinds of screen width/height ratios.
  4. Also you have to look through project navigator and remove all files that probably exist as launch images (they are named 'Default.PNG', ''Default2X.PNG' or something).

Upvotes: 1

Mike K
Mike K

Reputation: 961

Suggesting a workaround: If it is an iPhone only app you can simply disable Size Classes from Storyboard: click on view -> enter file inspector (first tab of right panel) and uncheck "Use Size Classes".

Upvotes: 0

Related Questions