AutoLayout for only iPad application - ios

I would like to start my application that need to support for only iPad devices. Now, my question is do I need to use the Autolayout functionality?
What am thinking is as my app supports only iPad,no need to use the autolayout because all the ipad devices uses same size classes.
Correct me if am wrong.

You have to use size classes even if you are using only iPad device as target for your application. There are some reasons why you have to use the size classes :
1) iPad have diff screen sized and resolutions as well. check them Out here.
2) The iPad multitasking feature is there from ios 9 so you need to resize your views according to that and that will need size classes check it out here.
NOTE : if you are using autolayout then no need to use size classes but size classes are important you can check the importance of the size classes and its working in apple's design guide line (here)

ipad has different device size like 768 x 1024 and 1024 x 1366 (ipad pro) etc. so, you should use autolayout to manage it for every ipad device.

Related

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
!

iOS handle Layouts for ipad pro?

How to handle Layouts for iPad pro as there is nothing to manage different image sizes in xcasset. also my current UI for iPad air 2 seems to b disturbed in iPad pro. any suggestions or a way to handle it?
You can't do in image asset.
Both iPad and iPad Pro uses the same size classes (Regular-Regular) for both orientations and in xcasset you can identify images eventually by their size classes or major device type (iPad vs iPhone vs watch) .
The only thing you can do is provide images a little bit bigger, or fix the size of image views and, instead, make some other elements with flexible width and height, such as space between images or the elements.
As pointed by Julian is worth to mention that is possible to detect the device type at runtime by inspecting UIDevice class properties and select the proper image at runtime. Apple do not support those methodology.

Do you have to use Size Classes if you are developing for iPhone only?

I understand the role of auto-layout but if I am developing for iPhone devices only, should I still use size classes? From my understanding, size classes are extremely useful if I am developing for iPad as well, in my case I am not. Would the more sensible option be to use size classes but just use COMPACT WIDTH | REGULAR HEIGHT ?? Or should I not use size classes and just build my app using auto-layout?
There are two situations where size classes are useful in the iPhone development:
If you want to support landscape and portrait and want to have different constraints in different orientations and even hiding/showing different vies.
If you want to do a SPECIFIC layout for iPhone 6+ in LANDSCAPE
If you don't want these two conditions, you can ignore size classes them or disabling them.
For more information on the differentiation you can have with the current devices check out this link.
The problem with iphone is that there 4 sizes of iphone in the market right now.
Iphone 6 Iphone 6 Plus Iphone 5 Iphone 4
Using COMPACT WIDTH | REGULAR HEIGHT will limit your option when you rotate your device
iphone 6 iphone 5 and iphone 4 when rotated ->
COMPACT WIDTH | COMPACT HEIGHT
Therefore I would rather recommend you to code in ANY WIDTH|ANYHEIGHT so it is more compatible to any UI SIZE
*note size classes is useful when implementing extra buttons in different UI
ie. suppose you create an calculator app, in an iPad it can fit extra button while in iphone you can't . so you use size classes to make sure you share the same codebase
source CS193p, stanford IOS 8 course

Supporting multiple iPhone resolutions with a single storyboard

We all are going to update our apps to iphone 6 and iphone 6 plus. That means we need to support 4 sizes.
1.) 3.5
2.) 4
3.) 4.7
4.) 5.5
Can we support all these screen sizes with single xib or storyboard ? also please share your views on how we can update our existing apps for iphone 6 and iphone 6 plus.
Yes. See Apple's iOS8 documentation specifically, size classes:
iOS 8 makes dealing with screen size and orientation much more versatile. It is easier than ever to create a single interface for your app that works well on both iPad and iPhone, adjusting to orientation changes and different screen sizes as needed. Design apps with a common interface and then customize them for different size classes. Adapt your user interface to the strengths of each form factor. You no longer need to create a specific iPad storyboard; instead target the appropriate size classes and tune your interface for the best experience.
There are two types of size classes in iOS 8: regular and compact. A regular size class denotes either a large amount of screen space, such as on an iPad, or a commonly adopted paradigm that provides the illusion of a large amount of screen space, such as scrolling on an iPhone. Every device is defined by a size class, both vertically and horizontally.
There is also a very good tutorial video on the WWDC site.
In order to stop your iPhone 6/6+ app being scaled, add a launch image of the correct size or better, use a launch storyboard.
From there you should use AutoLayout and avoid hard coding to screen sizes. In the long run it'll be a lot less effort and less error prone.
In existing projects you can use autoresizing or auto layout of xib files.. that support all 4 devices.
I have implement my projects using autoresizing to support all devices.

Building interfaces for 3.5-inch iPhones in Xcode 6

In Xcode 6, the way layout is done for devices of varying sizes has been changed somewhat: we now have Size Classes. But how can I lay an interface out for a 3.5-inch iPhone?
The "compact" height class doesn't seem to apply here. I understand I can change the constraint / compression resistance (etc) values, but in my case I want to be able to change the font size for this device size.
Is this completely impossible? I realize iOS 8 removes support for iPhone 4 (but not 4S). We also can't all target purely iOS 8, and need to support 7 and even 6.
There doesn't appear to be any way to use size classes to isolate a specific device size. I guess Apple didn't intend this feature to be used to build different layouts based solely on screen size, rather look at broader concepts, such as orientation and device type (iPhone, portrait or iPad, landscape). In other words "don't have different designs for iPhone 4/4s, 5/5c/5s or 6/6+"...
I have the exact same problem as the OP, in as much as I want a different layout only for 3.5" screens, but I ended up resorting to removing constraints and adjusting the layout programmatically, only for 3.5" screens.
iPhone 3.5 inches will have the following size classes:
Compact w Regular h - in portrait
Compact w Compact h - in landscape (unique for iPhone 3.5 inches)
So that is the only size classes you can use to manipulate for iPhone 3.5 inches.
It appears that some of the size classes do work with iOS 7 according to the link provided by '#Guillaume Algis' How can Xcode 6 adaptive UIs be backwards-compatible with iOS 7 and iOS 6?
However there is no info about their support in iOS 6 and still there are issues even with iOS 7.
If you really need to support iOS 6 and 7 and you are ok with the AutoLayout + multiple storyboards/xibs for different device idioms approach, than you can simply disable size classes for your storyboards/xibs using the File Inspector by unchecking "Use Size Classes" checkbox.

Resources