How to make layout Flexible in all versions of iPhones - ios

I have made an app which runs fine on iPhone6 but when I switch to iPhone5s and iPhone5 my layout completely distracts. Every Control Changes its position.
How can I make my app to run on all versions of iPhones fine without breaking the layout.
I have disabled the Auto Layout and I am Using AutoResizing from InterfaceBuilder.

I have a similar situations with my apps.
If you try make flexible in all devices using Autoresizing, you will have a lot of problems to do that, because the Xcode 6 (Interface Builder) is based to use with AutoLayout and Size Classes. In my apps, I have strange behaviors without them so... I recommend like #Volker, use AutoLayout (and size Classes), but if you don't want it or you don't have time at this moment...
You must create a Storyboard for any device screens or you must program to adjust your interface for every device. If you found another way to do that, please share it.

Related

How to efficiently use Autolayut and Auto-Resizing in same target?

I have one target. It's a login based application. Because of legacy code, I am forced to use Auto-Resizing in some View Controllers whereas I have updated newer UI using Auto-Layout.
If the Autolayout has to work on iPhone 6 and 7 (4.7"/5.5" screens) I have to add the launch images for these.
PROBLEM:
All my screen that are not using auto layout gets disturbed when I add the Launch image.
If I don't use the launch screen images, all the View that use auto layout are scaled up and appears slightly bigger than expected.
I do not have the luxury to update the legacy code to use auto layout.
Can someone please give me an alternative or a work around.?
If I don't use the launch screen images, all the View that use auto layout are scaled up and appears slightly bigger than expected
Correct. This is because, without the launch screen, your app is no longer compatible with devices like the iPhone 6 and 6 Plus. To compensate, the app is treated as if this were an iPhone 5 and is shown in zoomed mode.
So if you want to run at native resolution / size on iPhone 6 and later, you must have the launch screen. That being so, setting up your interface to deal with the larger size is up to you. You do not have to adopt auto layout; autoresizing still works fine. (However, using auto layout would be better.)

How do I adjust my layout?

I am moving from Android to IOS, and am following this tutorial. The problem is that my layout is not adaptive, as should be the default. The tutorial shows the layout to be like so:
However, my layout is not adaptive (universal) for both iPad and iPhone, and the UI is only that of an iPhone:
I searched a lot on why my layout is not universal (it should be by default), and most of the results said I need to enable Size Classes.
For me, however, the option to enable Size Classes isn't even there, I have the options:
Use Auto Layout
Use trait variations
Use as launch screen
How do I make my storyboard adaptive and enable Size Classes?
Thanks,
Ruchir
I think your UI is adaptive, it's just that in Xcode 8 the storyboard shows the UI in whatever device you have selected. If you look at the bottom of your screen in storyboard view it's says iPhone 6s, click that and you can select to view as a different device (iPad included). So even though it doesn't look like it, it should be adaptive.
As a side note size classes are only for if you want the UI to be different between devices, not adaptive.

How do you build apps for all iOS devices?

I have an app that is nearing completion. However, I don't know how to finish it so it will look good on all iOS devices. It's a portrait only app, and it is the same on all devices (bigger screens don't show anything extra or different from smaller devices).
How do I make constraints that will work on all devices? I know there are different size classes that Xcode has, but it seems tedious to go to each class and add specific constraints.
You should use Autolayout for all resizing of your UI. But if you still want to go with this, I found this thread What setting determines whether an app gets scaled for iPhone 6 and 6plus?
Again, try to use Autolayout, add constraints its very easy. If you wish to change your mind go through the tutorial and add constraints https://www.raywenderlich.com/115440/auto-layout-tutorial-in-ios-9-part-1-getting-started-2

Resize UI to fit iphone 6/6+ without using auto-layout

I am building an ios app and I have been developing it on iphone 5 size class. I have done it this way because I have not yet learned how to use auto-layout. I was wondering if there was a way(other than auto-layout) that I can use, on this app so that the view fits perfectly in iphone 5/5c/5s and 6/6+
Without auto-layout the available solutions will be pretty rough. Because your lengths are all hard values-- you will have to manually manipulate them to achieve the size you want in an iPhone 6. It would definitely still be slightly more time consuming to apply auto-layout constraints onto all of your views-- but you would be safe from having to do this again in the future. Hopefully you don't have too many views :)

Do I still need two Storyboard files to manage different devices now with Universal Storyboards?

I have an iPad only app that I'm switching to support iPhone as well. Not going well so far, the project was created before universal storyboards. When I run it on the iPhone, it sticks with the good ol' iPad size. Should I delete my storyboard and add a Universal one, or create separate Xib's / Storyboard's to support iPhone's?
I don't think you need to create separate xib or storyboard to support iPhone.
You can enable auto layout and size classes in your storyboard. Auto layout helps you layout your views based on constraints while size classes helps you check whether the view is running in iPad or iPhone, as well as the device orientation.
You can then layout your screens based on different size classes.
Please check WWDC video Building Adaptive Apps with UIKit for more information.
You can use a second storyboard but in my opinion it is easier to generate all the objects in code. Then you can use values like this: self.view.frame.size.width/2 to center it on the x-axis on every device. And you don't need a storyboard for every screen size.

Resources