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.
Related
I have designed my app without auto layout and for the size 320*568 (iPhone SE). The design i did for iPhone SE itself worked up to iPhone 7plus bcoz of adding corresponding launch image. Even it now works for iPhone 8 plus. But for iPhone X, it doesn't seem to be appearing full screen(Pl find the below image). Is there a quick fix or do i have to use autolayout to get it right?
Autolayout is the best for the iOS design to make it responsive according to the different device, so it is suggested to use autolayout. There are some reasons for why we should use the autolayout ?
It assures that it looks fine on all the devices.
It requires less effort to make design responsive if you are looking for different sizes or orientation.
It is easy to update the design when there is new device introduced.
And for particularly your question. If you want great design on all the device including iPhone X you should use 'Safe Area' + 'Autolayout'.
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.
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
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
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.