Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 698
obeattie Avatar asked Aug 05 '14 12:08

obeattie


2 Answers

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.

like image 108
shashwat Avatar answered Oct 04 '22 04:10

shashwat


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.

like image 43
Anton Matosov Avatar answered Oct 04 '22 04:10

Anton Matosov