Professional Documents
Culture Documents
Questions WD
Questions WD
Quick Guide
useyourloaf.com
Version 1.3
© 2017 Keith Harrison
Introduction
Apple introduced the concept of adaptive user interfaces in iOS 8
relying on a combination of Auto Layout and size classes. Building
user interfaces that adjust to changes in size class became even
more important when Apple added slide over and split screen
support to the iPad in iOS 9.
The problem is that I can never remember which devices support
which size class in which orientation (landscape or portrait). The
added slide over and split screen combinations don’t make it any
easier. Finding the details in the Apple documentation is tricky so for
future reference I have collected them into this short guide.
Size Classes
There are two size classes that can apply to the horizontal (width)
or vertical (height) dimension of an application interface:
Further Reading
• UITraitCollection
• Adopting Multitasking Enhancements on iPad
• WWDC 2015 Getting Started with Multitasking on iPad in iOS 9
regular Portrait
height
compact
Landscape
height
compact regular
width width
regular Portrait
height
compact Landscape
height
compact compact
width width
regular
Portrait
height regular
Landscape
height
regular regular
width width
compact compact
width width
regular compact
width width
compact compact
width width
regular regular
width width
C Plus
R C
C R
C
R = Regular C = Compact
iPad
R R
R C C
R R
R R C
R iPad Pro
R 12.9-inch
C C R R
Swift
func willTransition(to newCollection: UITraitCollection,
with coordinator: UIViewControllerTransitionCoordinator)
- viewWillTransitionToSize:withTransitionCoordinator:
Called when the view controller’s view size is changed by its parent.
Objective-C
- (void)viewWillTransitionToSize:(CGSize)size
withTransitionCoordinator:
(id<UIViewControllerTransitionCoordinator>)coordinator
Swift
func viewWillTransition(to size: CGSize,
with coordinator: UIViewControllerTransitionCoordinator)
traitCollection
Swift
var traitCollection: UITraitCollection { get }
- traitCollectionDidChange:
Swift
func traitCollectionDidChange(_ previousTraitCollection:
UITraitCollection?)
Swift
unspecified
compact
regular
UIUserInterfaceIdiom
Objective-C
UIUserInterfaceIdiomUnspecified
UIUserInterfaceIdiomPhone
UIUserInterfaceIdiomPad
Swift
unspecified
phone
pad
UIForceTouchCapability
Objective-C
UIForceTouchCapabilityUnknown
UIForceTouchCapabilityUnavailable
UIForceTouchCapabilityAvailable
Swift
unknown
unavailable
available
Swift
unspecified
SRGB
P3
UITraitEnvironmentLayoutDirection
Objective-C
UITraitEnvironmentLayoutDirectionUnspecified
UITraitEnvironmentLayoutDirectionLeftToRight
UITraitEnvironmentLayoutDirectionRightToLeft
Swift
unspecified
leftToRight
rightToLeft
UIContentSizeCategory
Objective-C
UIContentSizeCategoryUnspecified
UIContentSizeCategorySmall
UIContentSizeCategoryMedium
UIContentSizeCategoryLarge
UIContentSizeCategoryExtraSmall
UIContentSizeCategoryExtraLarge
UIContentSizeCategoryExtraExtraLarge
UIContentSizeCategoryExtraExtraExtraLarge
UIContentSizeCategoryAccessibilityMedium
UIContentSizeCategoryAccessibilityLarge
UIContentSizeCategoryAccessibilityExtraLarge
UIContentSizeCategoryAccessibilityExtraExtraLarge
UIContentSizeCategoryAccessibilityExtraExtraExtraLarge
Swift
unspecified
small
medium
useyourloaf.com/newsletter