Add iPhone X layout support to old Xcode 7 / Swift 2 project - ios

What I have?
An old project using Swift 2 and building/running without any issue on Xcode 7. It has a lot of dependencies and sophisticated architecture which makes it complicated to migrate to swift 3/4 (in a short period of time).
When app is running on iPhone X it has black bars on top and bottom of the sreen (sizing like on iPhone 6/7/8)
What I need?
I need to make the app running on iPhone X without black bars on top and bottom of the screen (fullscreen) without updating whole project. Are there any ways making it possible?
What I've tried?
Making constraints directly to the containing superviews and not the layoutGuide
Removing launchScreen assets and sticking only to LaunchScreen.xib

There are only two ways to remove black bars for a newer device size:
Launchscreen images assets with the new size
Launchscreen storyboard
And, well, you're out of luck, because both solutions require Xcode 9 for iPhone X size support. So you must go for Swift 3.2 at least.

Related

App run on simulator does not respect points or fonts from storyboard [duplicate]

This question already has an answer here:
How to efficiently use Autolayut and Auto-Resizing in same target?
(1 answer)
Closed 5 years ago.
I am working on new features (with Swift) on a legacy project ( Objective-C ) project.
Everything that I am receiving from designer (dimensions in points, font dimensions) put into storyboard or xib files got bigger in old project.
In SIMULATOR, here is an example with a uiview height and font dimension for iPhone 7
We tried:
Designer gives all dimensions in points. He is currently designing for iPhone 7/6. I am using in storyboard iPhone 7 view.
In a new project the correspondence is 1:1.
In the legacy project everything shows a little bigger.
What shall I search?
The iPhone 6 was introduced alongside iOS 8 and Xcode 6. As part of the introduction of the larger screen sizes, a legacy path was created that would allow older apps to run in a mode as if they were on an iPhone 4/5 screen size, simply scaling up the interface. This was intended to give app developers time to opt into the native, larger resolution of the iPhone 6 and 6 plus. In your question, I noticed this:
The larger battery icon is from your legacy app, while the smaller is from your brand new application. The contents of the status bar being scaled is a sure tell sign that the app is in this legacy mode. (Also, the interface often appears kind of fuzzy)
Therefore, I think your legacy app must have never adopted the launch screen storyboard or xib file that is needed to take advantage of the native resolution of the larger devices. To adopt it, you can see this answer.

Change UINavbar height from for older apps build using Xcode 5 or older

I've noticed the navigation height for the apps that I started with Xcode5 and older is larger than if i create a new application using Xcode6. Is there a way to change the height of the navigation bar. I can't seem to find a solution.
Thanks.
You need to add launch image assets for the iPhone 6 and iPhone 6 Plus. This is a really good answer on how: Enable Native Resolution on iPhone 6 and 6 Plus

iPhone 6 - app does not fill screen

Most of my apps scale up when run on an iPhone 6, but for some reason one of my apps looks like this:
What would cause it to not just scale up and fill the screen?
EDIT: Here are some repro steps:
Create a new project (Single View). Turn off size classes and just use iPhone.
Make the background orange.
Add a yellow UIView subview at (20,20,280,200).
In Xcode you get this:
Now simulate on iPhone 6. You get this:
Why doesn't it just scale up and look normal?
Not sure why this is getting downvoted. It's a legitimate question. And here's the legitimate answer:
Remove the "Launch Screen File" in Projects > General. Xcode 5 did not have this so older apps scale up automatically. Apps created with Xcode 6 get a default Launch Screen file created.
Removing it will make your app scale up on iPhone 6.
I have got the same problem and I managed to solve it by adding constraints to my ViewController in the storyboard.
Make sure that you clicked the ViewController of your scene. They yellow button in the this screenshot.
Click Editor-> Resolve Auto Layout issues -> Add Missing Constraints
Now you will find that the background image is scaled up to fill iPhone 6 or iPhone 6 plus.
Note that this solution works for me even if I did not provide any launch screen file.
I had the same issue. Searching for an answer, most of them mention the launch image. To me, what did the trick, was that I first enabled launch image for iOS8.0 and later in Xcode, which requires the native resolution sizes for 4.7" and 5.5". Adding these sizes didn't help, but when I re-disabled them, it started working!
If you do have any launch image, you will need launch images for all appropriate sizes. I was doing a minor update to an app, and it was not showing correctly on the iPhone 6 simulator. I created four launch images (.png files). Since the app should still run on iOS 7, I apparently could not use an asset catalog. I gave the images the correct names, and all is good.
Image sizes and names may be found here:
Sizes and Naming of Launch Image for iPhone app in iOS8

Layout issues with XIB in Xcode 5 (after upgrading app)

I have worked on this application, done 2 years back, using XIB's and Autosizing.
Now, I've upgraded this app (in Xcode 5) & I need to make changes according to iPhone 5 (4") and iPhone 4, 4s (3.5")
I've tried to put Margin layouts but these are not making any difference.
I've created quite a few apps before using similar techniques with out any complication but in this app, the view in iPhone4 has a black cut at the top and bottom of the screen.
![enter image description here][2]
This issue is not related to AutoSizing.
You're just missing the 640x1136 launch image (i.e. Default-568h#2x.png).
Add it and your app should go full screen.
PS: This happened to me when I created an iOS7 project in Xcode 5 and deleted Images.xcassets from the project targets.
reference

ios app not fitting iphone 5 screen

My ios app does not fit on iphone 5 screen. When I run the app, I can see blank space at the top and bottom of the screen. I have made the app compatible for both iphone sizes. But Since I have updated to the latest xcode, I am facing this issue. See screen shot. Can any one please help?
You probably may not have set your Default-568h image.
On the simulator make sure you have set to iPhone (Retina 4-inch).
You can do this by going simulator menu at the top go to Hardware->Device->iPhone (Retina 4-inch) that will change the phone simulator to the iPhone 5 version.
click here for more get information for naming convention of images [here]Naming convention for iPhone 5 images? [here]
Try setting AutoresizingMask to your container views instead of assigning appFrame.
I have faced the same problem while moving to iOS 7.
Solution comes with AutoresizingMask. iOS 7 has full Screen layout for ViewControllers.

Resources