Xcode 7 auto layout always renders 4:3 ratio - ios

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.

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

It happens cause you do not have Launch images properly set.
Go to image assets
Hit + => "App Icons & Launch Images" => "New iOS Launch Image"
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.
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).

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".

Related

iOS 13 Project without Storyboard displays funny

I have this project that is not using storyboards when I run it on my iPhone simulator it is not coming up full screen ?
From the viewcontroller property inspector select the presentation and set it to full screen it will work check the below image
check the content mode it should be scale to fill and size as freeform
Add below image to your project. Using the name Default-568h#2x.png
Because Xcode doesn't know your app size so this will pickup smallest size 320x480. With this image and name I suggest above, Xcode will recognize your app support bigger size.
Don't worry when running your app in smaller device, it's still OK.
Image HERE
This might be related to issue in launch screen. I also setup the project without storyboard but deleted the LaunchScreen.Storyboard as well and ended up getting the same screen as yours. After I recreated the project but leave the launchScreen file i was able to get the full screen display for my viewcontroller

App does not fit on anything but an iPhone (Plus Models) [duplicate]

Running my App in the iPhone X Simulator (GM Seed) I am noticing two strange effects:
the App does not use the full screen space (top and bottom area is black)
a strange white bar beneath the title bar
Does anybody know what is happening here and how to resolve this? I can't find any new settings in Interface Builder.
When using launch images (instead of the much easier Launch screen file), you need to provide the properly sized launch image for each device size you wish to support. Once you add the additional launch image, your app should take advantage of the new screen size.
The new iPhone X requires a launch image sized at 1125px × 2436px which is a 3x image for 375pt × 812pt.
Of course if you switch over to using a Launch screen file instead of individual launch images, your app will automatically adapt to all device sizes without any additional work.
I have figured out this issues in iPhone X. Launch image size (1125*2436px)
Please flow this below steps.
1.i)Choose your project name in Xcode.
ii)Select your project target
iii)Then select Launch images source
You can get Migrate popup
i) Choose Assets
ii)Select Migrate
After that select your Assets.xcassets in your project
Then select Launch image in assets
i)Then select attribute inspector
finally check your Launch image source. you can see set Launch image.
iPhone X needs different launch image sized 1125px x 2436px (375pt x 812pt #3x).
Check human interface guidelines for more details.
I have figured out how to fix (though I still don't understand why this happened only on iPhone X) LaunchScreen storyboard on iPhone X with seeing black top&bottom bars.
I have LaunchScreen storyboard with one UIImageView.
UIImageView's top&bottom has to be pinned to SuperView's top&bottom. NOT to SafeArea.
I fixed it by simply inserting some random text in the Lanch Screen File textfield. I dont even have a Launch Screen File... XCode is so buggy.
update
Although this fixes it in simulator (still very weird and unexpected) when uploading a binary to iTunes Connect it will fail due to not finding a LanchScreen file of name "random-name"
Just ran into this while trying to update an app I hadn't worked on in a while.
On Xcode 9.4, I was able to fix this by doing the following:
Add a launch screen by going to File -> New -> File... -> Launch Screen
Make sure the newly added launch screen storyboard is selected as the launch screen file under project settings.
If you already have a 1125px × 2436px launch image but the app is still not using the full screen check to make sure that your image is PNG.
if you removed LaunchScreen.storyboard; Choose your project, select your project target, General -> App Icons and Launch Images -> Launch Screen File: Select here Main.storyboard instead of LaunchScreen.storyboard
Just had this problem... When I selected the project & the correct target I had a blank for the 'launch screen file' under the app icons and launch screen images tab. I set it to the default LaunchScreen and the resizing issue I faced was taken care of.
You may check in project target launch screen file is not set to empty if it is empty it may cause problem.
Yes me too face that top spacing issue in iOS 15,
iOS 15 needs some new size of the Launch images
So you please check your all the launch screen images
Check your Attribute inspector is portrait for Launchscreen

iPhone X safe area size [duplicate]

Running my App in the iPhone X Simulator (GM Seed) I am noticing two strange effects:
the App does not use the full screen space (top and bottom area is black)
a strange white bar beneath the title bar
Does anybody know what is happening here and how to resolve this? I can't find any new settings in Interface Builder.
When using launch images (instead of the much easier Launch screen file), you need to provide the properly sized launch image for each device size you wish to support. Once you add the additional launch image, your app should take advantage of the new screen size.
The new iPhone X requires a launch image sized at 1125px × 2436px which is a 3x image for 375pt × 812pt.
Of course if you switch over to using a Launch screen file instead of individual launch images, your app will automatically adapt to all device sizes without any additional work.
I have figured out this issues in iPhone X. Launch image size (1125*2436px)
Please flow this below steps.
1.i)Choose your project name in Xcode.
ii)Select your project target
iii)Then select Launch images source
You can get Migrate popup
i) Choose Assets
ii)Select Migrate
After that select your Assets.xcassets in your project
Then select Launch image in assets
i)Then select attribute inspector
finally check your Launch image source. you can see set Launch image.
iPhone X needs different launch image sized 1125px x 2436px (375pt x 812pt #3x).
Check human interface guidelines for more details.
I have figured out how to fix (though I still don't understand why this happened only on iPhone X) LaunchScreen storyboard on iPhone X with seeing black top&bottom bars.
I have LaunchScreen storyboard with one UIImageView.
UIImageView's top&bottom has to be pinned to SuperView's top&bottom. NOT to SafeArea.
I fixed it by simply inserting some random text in the Lanch Screen File textfield. I dont even have a Launch Screen File... XCode is so buggy.
update
Although this fixes it in simulator (still very weird and unexpected) when uploading a binary to iTunes Connect it will fail due to not finding a LanchScreen file of name "random-name"
Just ran into this while trying to update an app I hadn't worked on in a while.
On Xcode 9.4, I was able to fix this by doing the following:
Add a launch screen by going to File -> New -> File... -> Launch Screen
Make sure the newly added launch screen storyboard is selected as the launch screen file under project settings.
If you already have a 1125px × 2436px launch image but the app is still not using the full screen check to make sure that your image is PNG.
if you removed LaunchScreen.storyboard; Choose your project, select your project target, General -> App Icons and Launch Images -> Launch Screen File: Select here Main.storyboard instead of LaunchScreen.storyboard
Just had this problem... When I selected the project & the correct target I had a blank for the 'launch screen file' under the app icons and launch screen images tab. I set it to the default LaunchScreen and the resizing issue I faced was taken care of.
You may check in project target launch screen file is not set to empty if it is empty it may cause problem.
Yes me too face that top spacing issue in iOS 15,
iOS 15 needs some new size of the Launch images
So you please check your all the launch screen images
Check your Attribute inspector is portrait for Launchscreen

iPhone X Simulator not running my app in full screen [duplicate]

Running my App in the iPhone X Simulator (GM Seed) I am noticing two strange effects:
the App does not use the full screen space (top and bottom area is black)
a strange white bar beneath the title bar
Does anybody know what is happening here and how to resolve this? I can't find any new settings in Interface Builder.
When using launch images (instead of the much easier Launch screen file), you need to provide the properly sized launch image for each device size you wish to support. Once you add the additional launch image, your app should take advantage of the new screen size.
The new iPhone X requires a launch image sized at 1125px × 2436px which is a 3x image for 375pt × 812pt.
Of course if you switch over to using a Launch screen file instead of individual launch images, your app will automatically adapt to all device sizes without any additional work.
I have figured out this issues in iPhone X. Launch image size (1125*2436px)
Please flow this below steps.
1.i)Choose your project name in Xcode.
ii)Select your project target
iii)Then select Launch images source
You can get Migrate popup
i) Choose Assets
ii)Select Migrate
After that select your Assets.xcassets in your project
Then select Launch image in assets
i)Then select attribute inspector
finally check your Launch image source. you can see set Launch image.
iPhone X needs different launch image sized 1125px x 2436px (375pt x 812pt #3x).
Check human interface guidelines for more details.
I have figured out how to fix (though I still don't understand why this happened only on iPhone X) LaunchScreen storyboard on iPhone X with seeing black top&bottom bars.
I have LaunchScreen storyboard with one UIImageView.
UIImageView's top&bottom has to be pinned to SuperView's top&bottom. NOT to SafeArea.
I fixed it by simply inserting some random text in the Lanch Screen File textfield. I dont even have a Launch Screen File... XCode is so buggy.
update
Although this fixes it in simulator (still very weird and unexpected) when uploading a binary to iTunes Connect it will fail due to not finding a LanchScreen file of name "random-name"
Just ran into this while trying to update an app I hadn't worked on in a while.
On Xcode 9.4, I was able to fix this by doing the following:
Add a launch screen by going to File -> New -> File... -> Launch Screen
Make sure the newly added launch screen storyboard is selected as the launch screen file under project settings.
If you already have a 1125px × 2436px launch image but the app is still not using the full screen check to make sure that your image is PNG.
if you removed LaunchScreen.storyboard; Choose your project, select your project target, General -> App Icons and Launch Images -> Launch Screen File: Select here Main.storyboard instead of LaunchScreen.storyboard
Just had this problem... When I selected the project & the correct target I had a blank for the 'launch screen file' under the app icons and launch screen images tab. I set it to the default LaunchScreen and the resizing issue I faced was taken care of.
You may check in project target launch screen file is not set to empty if it is empty it may cause problem.
Yes me too face that top spacing issue in iOS 15,
iOS 15 needs some new size of the Launch images
So you please check your all the launch screen images
Check your Attribute inspector is portrait for Launchscreen

How to prevent Xcode/Interface Builder from auto-shifting view down?

Without modifying any code in a new Xcode 6.0 Single View project targeting iPhones running iOS 7.1, the result on my testing iPod Touch 5th gen device shows a shifted version of what's in Interface Builder. It appears the shift is downward. I've already tried turning off Auto Layout and Size Classes, and resetting all UIView coordinates to (0,0), but still the battery symbol and upper bar is too far down! Please see pictures below for Interface Builder screenshot, and device screenshot. The question is how can I keep what I see in Interface Builder, and stop the iPod from shifting down the entire UIViewController? Thanks!
UPDATE: In the end, I had to go into project build settings, click on the app under Targets, and change Launch Images Sources to a new folder it titled "LaunchImage-2" and delete the Launch Screen File field, which was set to Launch Images.
If you don't add the Default-568h#2x.png
then xcode build the project of size 3.5 inch and shows black patch at the bottom.
So you have to compulsory add the image with name Default-568h#2x.png of size 640 x 1136
If you use an empty Asset Catalog for your Launch Images, the iPhone 5's screen size is supported (without having to include any image files at all).
It seems that you need to add the default or launch images into the project. Your project should be using image assets, so there you will see launch images and you need to supply images of appropriate sizes, preferably for all iPhone screen sizes.

Resources