I am new in iOS development and just studying Adaptivity and Layout I am stuck with a little confusion,
As per the Documentation
iOS defines two size classes:
By other references :
All iPhones (top left) in the portrait orientation have a regular height and a compact width like
Iphone 4, 5 and 6 in landscape orientation have compact height and compact width.
But in case of iPhone 6 Plus, It has compact height and a regular width in landscape orientation.
My Confusion is :
Thanks in advance!, Warm welcome to editors!
I know it won't affect in development so far technically But I just want to make my mind clear of these things.
With the iPhone 6 Plus, 6s Plus, and 7s Plus, you have the ability to use the home screen in landscape mode (with the iPhone held horizontally) or in portrait mode (the iPhone held vertically).
The Compact Size Class refers to a constrained space. It is denoted in Xcode as wC (Compact width) and hC (Compact height). The Regular Size Class refers to a non-constrained space. It is denoted in Xcode as wR (Regular width) and hR (Regular height).
Size classes are traits assigned to user interface elements, like scenes or views. They provide a rough indication of the element's size. Interface Builder lets you customize many of your layout's features based on the current size class. The layout then automatically adapts as the size class changes.
If so then why iPhone 6 plus is differ from them ? Is it because it's screen is 0.8" bigger then iPhone 6 ? Does it matters ?
It matters when you are using a split view controller. When it has the same collapsed aspect on iPhone 5 and 6, it will split and show master and detail view controllers side by side in landscape orientation on iPhone 6+.
It looks even more useless on iPad, since it has regular height and width size class on both portrait and landscape.
The point is, when you have regular size class, you should layout and show more content than on compact size class.
However size classes aren't related to the screen but to the view controller.
When you have your iPad with a master and a detail view controller, the master view controller has compact width/regular height, and the detail view controller has regular width/regular height.
You can still change child view controller's size classes by overriding them with
-(void)setOverrideTraitCollection:(UITraitCollection *)collection forChildViewController:(UIViewController *)childViewController
and
-(UITraitCollection *)overrideTraitCollectionForChildViewController:(UIViewController *)childViewController.
It's a key concept for iPad since you can now on iOS9 have your app running in compact width with the new multi-task feature (slide from the right of the screen).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With