Required to implement Autolayout Constraint and SizeClasses? - ios

I have an iPhone app which should support for iOS 7 to iOS 9(Enhancement) and all the screen sizes as well. Storyboards are enabled Use AutoLayout and Use Size Classes properties. I am not much familiar with using auto layout.
Do I need to add constraints for views to support all the screen sizes? Is there any other ways to achieve that? Launch Images and Icons are enough for all the screen resolutions? will make any problem when iTunes submission?

Yes to it is recommended to run application on all iphone as well as ipad using a single design , use these tutorials it would help
1.) https://developer.apple.com/library/ios/recipes/xcode_help-IB_adaptive_sizes/chapters/EnablingAdaptiveSizeDesign.html
2.) http://code.tutsplus.com/tutorials/an-introduction-to-adaptive-design--cms-22888

Related

Does the app get auto resized?

Does the application get auto resized when uploaded to the AppStore to fit all devices like iPhone 5 and iPhone 7+ ?
I'm asking this because I'm about to release a new app for the Appstore but in the simulator and on a real device the application doesn't gets resized and all the buttons and label etc are not where they should be.
I am also developing an iOS app, so I understand your problem.
The application doesn't get resized.
The buttons/labels won't be put wherever they should be as Xcode doesn't know where to put them. This is because the screen size varies with each device.
You should use constraints (really good tutorial) to put your buttons/labels wherever you want them to be. Another good tutorial
It's not automatic. You need to design your app to handle layouts on different devices. It's a rather complex subject. You'll need to learn about AutoLayout and size classes, among other topics. If your app isn't handling this correctly, it's not ready for the app store.
Firstly check your application is universal application .
Then You need to look at your Auto Layout constraints inside your storyboard.
Understanding Auto Layout

Supporting all iphone sizes

I'm trying to create a iOS app, but I'm stuck on the layout.
I created the home view, but now I see that it's not shown in the right way in the 4S simulator.
I tried with size classes, but it looks like 4S and 6, for example, are in the same size class, and so I can't set a different dimension for views.
My goal is to support all devices, also iPads. Can someone please tell me how to do it?
Size classes mostly used for separation between ipad, apple watch and landscape modes.In potrait mode iphone 4 to iphone 6 all phone device sizes are in same class(regular height and compact width).Autolayout has many different constraints to help you to fit interfaces in same class.You should consider horizontaly/verticaly align, equal width and aspect ratio constraints.They are so flexible for smaller size changes and help you to design adaptive layout.
You should use "Reset to Suggested Constraints" for all views in your View controller. You can also check the simulated metrics for all devices without compiling the the code.
For 4s and 6 by default the size is Inferred. You should try resetting the constraints to check this for iPad as well.
I am just sharing an idea
Option1:
I think You can try adaptive Layouts and in file inspector->simulated Metrics->size-> Inferred. It works in all devices it supports both landscape and Portrait.
Option2: Go for Visual layouts they are easy to understand and they work perfect in all modes of Portrait.
I am think that you use code Instead design in main.storyboard !
for ex: create button with code
(and use Ratio in your code)
by this way i create small app for iPhone & iPad
!

is it possible to design view for iPad without autolayout?

I have developed app without autolayout for iPhone. Now I need that app for iPad also. Is it possible to create it without autolayout?
yes, you have to create App directly then select iPad.
and using Auto Resize ,you can directly develop app for iPad only.
I have attached few Screen shot, may be helpful to you.
Create new project, using XIB .
I don't recommend that (see comment of #Nimit Parekh).
You can use Sized classes to avoid having 2 separate Storyboards - one for iPhone and other for iPad. There is a good tutorial.
Second option is to have 2 storyboards. You only need to link all outlets from the 1st storyboard to the second. You have to check not to miss something, otherwise you can get exceptions in iPad.
The 3rd option is manually (from the code) to manage layout for iPad - but this will create a lot of specific code for iPad only (you have to check what type is your device and split code) - this is not recommended.
Take into account that Autolayout is more easy to apply on iPad (from my point of view) because of equal withd / height ratio for iPad - it is the same up to now. Not like in iPhone.

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