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

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

Related

Same Storyboard for different screen Sizes without Auto Layout

I've been using different storyboard for different screen sizes.
Now, I'm updating an old app with only one Storyboard for iPhones and it looks the same appearance as iPhone 5 in different iPhone simulators, without using auto layout. Works well on iPhone6 and 6 plus Simulator.
Can I trust this behaviour or is any simulator bug? Is it due to any Properties project config ?
You must use auto-layout otherwise it will not work 100%. If you enable auto resize subviews option in storyboard view then it might work upto some extent.
I got it... Just not setting any launch screen image for the devices without defined storyboard

ios swift - UI Designer Adaptive iPhone Layout

I've disabled size classes in my project and have 3 view controllers.
By looking at the preview of each of the view controllers, I've noticed that the iPhone 6 which is the one I've been running the application on shows a layout completely different than how it looks when you run it on the actual phone.
I'm trying to build an application with size classes disabled that will have an adaptive layout between iPhones. I was under the impression that size classes was geared towards adaptivity between iPhone and iPad applications?
My app looks good on the iPhone 6 and terrible on the 6 plus. I would like the layout to be adaptive between both iPhones. Any advice?
Thank you
PS: Using autolayout
First of all enable Size classes. This is how you can vary the changes for 6 and 6+. If you want the similar layout on both the devices then use 600x600 size. If you want different layout in 6 and 6+ then you have to switch the size class and change the constraints accordingly. Refer this link for tutorial: https://www.raywenderlich.com/113768/adaptive-layout-tutorial-in-ios-9-getting-started

Views in storyboard do not resize properly on iPhone 6

I've checked a lot of different websites and stackoverflow answers, and I'm still stuck.
I developed an app for iPhone and iPad targeting iOS 7.1. I have two storyboards, one for each device. The app only displays in portrait mode. I cannot seem to get the app to display full screen on the iPhone 6 simulator.
I've tried numerous things, I followed the advice linked here by adding a Launch Screen, setting the iPhone storyboard to auto layout and "use size classes", and . Not only does that not affect the size, but the Launch Screen doesn't seem to scale properly either. If I get it to fit the iPhone 6 it doesn't fit the iPhone 5 properly.
I've tried adding the proper launch images and I don't get any errors saying the wrong image resolution is present.
I've used the storyboard as a Launch Screen described here.
Now, when I switched to "use size classes" I could manually extend the objects in the views to match up with the size of iPhone 6 (I have not tested it for 6s) but that makes it extend past the iPhone 5 boundaries. The only thing I can think of right now is to create another storyboard and detect if it's iPhone 6, but I would really like some other ideas.
Here's what it looks like for iPhone 6:
And here's what it looks like on iPhone 5:
Best advice i can give u is
Use default size class , the classic 600x600 and then use Auto Layout
Or do the reverse, take a 3.5inch size VC and apply Auto Layout on it. Everything will present itself quite perfectly if you can apply the right constraints
Here is a link for an awesome Autolayout tutorial

iOS scaled mode vs autolayout?

I've developed several iOS apps but never used auto layout when dealing with screen larger than 4 inch (iPhone 6 and 6+). What I did is to enable scaled mode (by deleting launch xib and adding launch image) and only layout views in 4 inch. Since they have same aspect ratio this could work.
But I'm wondering is there any drawbacks of using scaled mode instead of auto layout, or is there any particular reason to use auto-layout?
Since I think auto layout just too much work to do and I just want all the screens have same UI (i.e. the larger the screen, the larger the view, instead of keep the view size constant but more gaps)
Auto Layout is the future. If Apple comes out with a new iPad that's much bigger, do you want your app to be "scaled", or take advantage of the whole screen? Users will give you better reviews and be happier if your app is not scaled.
Auto Layout really isn't too much work. It's more work not to implement it, and you shut yourself out from features like Adaptive UI, and having one code base that runs on all their devices, present or possibly future.

Resize app designed for Iphone 6 to scale correctly in iphone 5s

Ok, here is the problem I have designed an application for iphone 6 screen without size classes and autolayout.
Looking like below in the storyboard. As you can see its simulated size is 4.7 inch.
It works perfectly when running on iphone 6 devices obviusly.
However when trying to run the app in other devices than iphone 6 it wont scale proportional.
My hope was that if I removed the lanuch screen images only keeping the iphone 6 size it would scale to fit other screens looking the same as if it where run on a iphone 6 only scaled up or down depenging on device.
My launch screen looks like this now
It does infact scale the app but it scales the app in wrong proportion making it looked chopped like this.
Iphone 5s version of the app looks like this
As you can see it scales correctly but the aspect gets wrong compared to the iphone 6 version below scaling correctly.
Here is an ipad version looking like the iphone 5s version scaling wrong.
It seems to me that the scaling works since I have removed all launch images except the 4.7 display (iphone 6) The problem however seems to be that it scales keeping the aspect of an iphone 5 in width making the iphone 6 display to wide.
I have tried to add launch images for all devices but the problem then is that I need to use autolayout and size classes to make it work.
Is there any way to for instance tell the scaling to keep aspect but use iphone 6 width and height intact without using size classes etc.
To make the question even more simple. Is there any way to scale an app made for strictly iphone 6 so resize to iphone 5s/ipad?
Any help is highly appreciated!
Well, the "trick" with removing the other launch images doesn't work, as you noticed yourself.. This automatic scaling only works from 4" to 4.7" and 5.5" and is only to support older apps on the new devices, not for general purpose "I am too lazy to support all sizes" use cases.. ;-) Apart from that, you should definitely support the native resolutions.
So, to answer your question: You can either just use Auto Layout. This is definitely the preferred approach - after all that's exactly the use case that it has been built for.
Alternatively, if you really don't want to or can't use Auto Layout, you either need to make sure to set your auto resizing masks correctly (e.g. "flexible width" on the stuff that needs to grow/shrink horizontally etc.), or adapt your frames manually in code (which partially defeats the purpose of IB).
If you didn't use Auto-Layout or Size Classes, your only hope is to programmatically change the positions/size of each element individually in the viewDidAppear or viewDidLayoutSubviews method of your LoginViewController. You would have to do it also on orientation change (if your app supports it).
It's a lot of work that can be easily be avoided by using Auto-Layout/Size Classes!

Resources