Auto layout or Autoresizing - ios

I'm starting to develop an app that will only be on iPhone and only portrait view. I'm wondering the best way to develop an interface for both iPhone 3.5 inch and 4 inch screen. Every tutorial i see for auto layout seems to use it for portrait to landscape, but for me that doesn't matter because landscape isn't an option. I'm just wondering if I'm only using portrait is it easier to go with auto resizing?
Edit: I'll be using some UI animations in the project as well.

That depends on how your view sizes and positions relate to each other. If you want to align various views, or have views move when the text in a button or label moves then auto-layout is your friend. If you just want to resize a scroll view to fill the available space then auto-resizing is much simpler.
Arguably, learning auto-layout on a relatively simple app is a wise move to support your future app building endeavours...

If you want to make a relation between subviews and superview go for auto-resizing.
Otherwise if you want to make the relation between view or their neighbors view or adjacent view then go for auto layouts.

Auto Layout, because new features and functionality will be designed to work with Auto Layout, and your app will be more likely to be laid out correctly on upcoming devices or operating systems.
A case in point for iOS 8 is Adaptive UI. Apple has figured out and handled most of the edge cases, and content adapts to its view controller being collapsed or separated, remaining properly sized regardless of the device orientation or size. One code base. No conditional code required.
When Apple comes out with a new device or operating system, it's more likely that your app will behave more robustly if you use Auto Layout. If you size things yourself, you may overlook an edge case or not be prepared for a new size class, and your layout might break.
It comes down to how much code you want to write, support, and upgrade, versus letting the SDK figure out sizing, positioning, and relationships for you. Does their code have bugs? Yes. Does our code have bugs? Yes. Either way, it's not a perfect world. But anyone who adopted Auto Layout earlier, got a lot of functionality for free later. I believe adopting Auto Layout and size classes will continue to pay off, even at this stage.

Related

Is multiple storyboards the only way to make my graphics-heavy app look good across all iPhones?

My app has a lot of image assets so adjustments I make (resizing and changing position on the screen) to my artboards that make it look good in iPhone X make it look awful in iPhone 5 or 6 or XR. The main problem seems to be reconciling different screen dimensions, rather than sizes. Is there another way besides doing a whole new storyboard for the taller X screen dimension?
We have tried auto layout but that only works for the UI elements, not image-only graphics. What we end up with is a compromise that doesn't look fantastic on either screen.
No, you can do that through Auto Layout. There are so many techniques, you can use multipliers, you can resize heights based on widths, you can make views have a percentage size of other views, possibilities are endless. You can even make custom constraints for a specific model.
You should study more about Auto Layout, it is possible to make them all look exactly like you want.

iOS 8 Adaptive layout and constraints on custom design

I am trying to use Adaptive Layout to upgrade my project for iOS 8-9.
I have read and watch a lot of tutorials but all of them are explaining how to adapt a simple design with rectangles and centre them on the screen.
I don't know why I find it so difficult to understand how it works for my design.
This is my design in storyboard and how I would like to appear on all of the iPhones in portrait mode:
Can someone guide me how to properly build the constraints on this View? I might be able to understand the logic of constraints for real designs rather than rectangles which are centred in the screen. shall I start to design from Compact&Regular?
Here are the views laid out for different iPhone screen sizes in portrait mode. I have made some assumptions about the rules for the placement of the views. You can see the constraints also in the screen print.

The best way to make a viewcontroller for different screens

I would like to know which is the best way to make a view controller for iOS 9 swift 2 xcode 7, for different iPhone screens?
I have tried to make it with constrains but from iphone 4s to iphone 6s screens we can see wide gaps between the icons and text fields etc.
What i'm thinking is to make different view controllers for each screen (5.5inches, 4.7inches, 3.5inches) and to make my app check with which screen the user is opening the app and load the unigue view controller for this screen.
Or maybe there is a better way but im new to swift 2.0 so i'm asking for your help!
Thanks a lot for your time.
You can make a views for multiple screens using autolyout and size classes. You have proportional constraints that fit on all screens.
Proportional constraints means you can set for example view1 is 50% of screen.
These constraints fit on all screens.
Avoid excessive use of size classes (applying constraint in different size class). Try to go with proportional constraints in hAny wAny layout.
Only go for different size class if design on ipad is different then iphone. Or if you need different font sizes on different devices.
https://developer.apple.com/library/ios/recipes/xcode_help-IB_auto_layout/chapters/EditingConstraintAttributesintheAttributesInspector.html
I think this depends upon what your requirement is and what you prefer.
I usually prefer the good old Springs and Struts.
They can be used by disabling auto layout and screen sizes.
Using Springs and Struts i only create a single Storyboard to manage all iPhone and iPad screen sizes without any coding effort.
No matter how complex the UI maybe, for me Springs and Struts are the best solution.
Size classes give you a more fine grain control for different sizes and orientations. Please refer Apple's documentation
As I understood your question that you want to load storyboard as size of screen of device.
I will suggest you to refer this link to load a different storyboard depending on screen size. Sorry for Objective c but hope it helps you.
Load different storyboards

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.

iOS storyboard layout

I am working on an app and have come into some graphical problems when designing my app.
First off, my app is only support by iPhone. My current storyboard is using the iPhone 5 as the screen size, so everything screws up when I try to run in iPhone 4 and 4S. Is there a way to make multiple storyboards for each different screen size? Or do you all have another solution?
Thanks!
- Brad
There is a way to make different storyboards for separate screen sizes, but another way to do it is like this:
Whenever you add objects to your views, be sure to have them aligned to something (using constraints). If all items are relative to other items, then most likely the layout will be fine on all devices. Also, if you find that your controls start overlapping, then perhaps you ran out of room. In that case simply add a scroll view to your layout, and then put the controls on top of it. Then, it won't scroll on the larger screens because all controls are shown, but on smaller devices it will allow you to scroll down to see the rest of the objects.
Good luck.
There is a small button in the lower right hand corner that lets you toggle between 3.5" and 4" screen sizes so you can see how it will look on different devices. By using Auto Layout introduced in iOS 6 you can make sure to set up your constraints so that your UI looks good on both older and newer iPhones.

Resources