How is Apple showing more in the Messages app in portrait on the iPhone 6 Plus? - ios

With the new iPhone 6 Plus, in landscape the phone can show more content than the normal iPhone 6 or its predecessors. This makes sense, as in landscape the phone identifies as having a "regular width" for its size class.
However, in portrait its' still compact width, regular height for the size class, regardless of which iPhone. How is Apple then showing more on the iPhone 6 Plus in portrait when there's no size class identifying it?
Are they hard-coding it based on the device's width? Doesn't that go against the whole philosophy of size classes?

They are using auto layout to force their labels to adopt the width of the screen. There's a good description of how to achieve this in this SO answer.
Apple have also used Adaptive layout to implement the landscape view on Mail for the 6+.

Related

Creating auto layouts for iphone se?

I'm making an app that I want applicable to all sizes but the problem is that iPhone 8 up to iPad devices are good but I noticed that the iPhone SE and below iPhones are not being supported when you make your app for iPhone 8 and up because it's so small. Now does that mean I have to create a scroll view for all my pages not since it doesn't fit for iPhone SE and below or is it recommended to not just include iphone se size and below for any future app?
It's recommended to create your app to be universal and support all screen sizes to hit users from the market as much as you can , regrading support for IPhone 4 , 5 I think you need to have a scrollView in any screen that you think it may exceed screen height for these 2 devices , or create items height in proportional to screen height to guarantee that all UI elements will fit in the screen

Size Classes & Plus Phone

So all phones have compact width/regular height in portrait. Plus phones have regular width/compact height in landscape while others have compact width/compact height.
So the only in LANDSCAPE orientation you can distinguish a plus model phone.
Question
Is there a way to distinguish a plus model phone in portrait orientation?
without checking for:
Screen resolution
Screen scale
Device strings
NOTE:
Checking for screen resolution/scale, device strings are plausible, however trying to stay away from those. For example, Apple had to put Contact Icons for Favorites for iPhone Plus in Portrait. So there has to be a formal way to do this?
You are getting it wrong. The main purpose to make the adaptive layout is it can adapt to any screen size irrespective of device.
You should not think about these devices screen size while making layouts. You should be thinking of size classes.
If your layout can work in above size classes than it should work in respective phones. Also if you are looking for orientation but your app support the multitasking than your layout might not work with that.
Ideally, Your app should have layout that can work in any screen size because apple is releasing new devices with different screen sizes so your app should be compatible and work in every layout.
But that is ideal world. You can handle most of your layout with size classes. In some cases you need to handle the special scenarios.

Is there a rule for Regular and Compact in Size Classe?

I am study Size Classes recently, and there is a form seems need me to memory:
As you see, I can not find the law(rule) of the Regular or Compact in the Vertical and Horizontal direction in defferent device.
Such as I have many doubt, such as :
why iPhone Landscape in Horizontal Size Class is Compact but iPhone 6p's Landscape is Regular?
Why iPhone Portrait's Horizontal Size Class is Compact?
I can not understand if there is a rule, so I can remember this form or understand this form here.
iPad is regular / regular (except in splitscreen mode).
Compact width distinguishes iPhone from iPad. Compact height distinguishes iPhone in landscape from iPhone in portrait.
The Plus devices are big enough with high enough resolution that in landscape they can contain the same interface as an iPad. For example, they have room for a UISplitViewController to display master and detail simultaneously. Thus they are exceptional.

Spacing layout elements with adaptive layout from iPhone 4s to iPhone 6+

I'm attempting to build a view (iPhone only, portrait view only) using adaptive layout. It should all be on a single screen (ideally no scrolling). I've managed to get it working (reasonably) for the iPhone 5 - 6+. However, my issue comes with the 4s.
I'd like, on the iPhone 4s to have the center image go away, which I thought I could use size classes, but it doesn't seem so for the various iPhones in portrait mode (only if I switch orientation).
Additionally, I'd like there to be more padding between all the elements on the 6+ while spacing remains the same on the 5 and 6.
No matter what sizes all iPhone in portrait mode is regular height compact width so size class won't help you here.
To change padding constraint
make the ones you want to change IBOutlets
and in viewDidLoad for example change the NSLayoutConstraint's constant value based on screen height.
For iPhone 4S you can
hide the center imageView
deactivateConstraints all it's constraints
and activate new constraint between the view above imageView and below imageView if needed

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

Resources