Supporting multiple iPhone resolutions with a single storyboard
Asked Answered
G

2

5

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.

Garrygarson answered 17/9, 2014 at 10:21 Comment(0)
H
7

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.

Heredity answered 17/9, 2014 at 10:24 Comment(4)
The size classes handle only the differences between the iPhone and iPad and between portrait and landscape. What I would be interested to know (and I guess the OP as well) is how to handle the layout on different iPhone sizes, as all the iPhones are in one size class.Rafe
Autolayout. Apple's strategy seems to be to divorce code from screen sizes (a very good thing) and push people down the path of autolayout with four general view "shapes" which can adopt different layouts.Heredity
Sorry but your comment is too generic. I was specifically asking how can one do that, from a practical point of view. I know that it should be done with autolayout, just don't know how exactly :-)Rafe
I'm not sure Apple do that - iPhone 6+ has a wide format in landscape so it is distinct. If you want to make a 6+ display a whole extra view than a 6 does in portrait you still have to check in code for the display size (or some other way of differentiating the devices). I don't think size classes can do magic.Heredity
U
0

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.

Underprivileged answered 17/9, 2014 at 11:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.