Protocol

UITraitEnvironment

A set of methods that makes the iOS interface environment available to your app.

Declaration

protocol UITraitEnvironment

Overview

The iOS interface environment includes traits such as horizontal and vertical size class, display scale, and user interface idiom. To access the trait environment of an object that adopts this protocol, use the traitCollection property. The protocol also provides an overridable method that the system calls when the interface environment changes. Implement this method as part of creating an adaptive iOS app.

For more about trait collections, see UITraitCollection. For the WWDC 2014 presentation on creating adaptive interfaces in iOS, see Building Adaptive Apps with UIKit.

Topics

Accessing a Trait Collection

var traitCollection: UITraitCollection

The traits, such as the size class and scale factor, that describe the current environment of the object.

Required.

Responding to a Change in the Interface Environment

func traitCollectionDidChange(UITraitCollection?)

Called when the iOS interface environment changes.

Required.

See Also

Adaptivity

Responding to Changing Display Modes on Apple TV

Change images and resources dynamically when the screen gamut on your device changes.

class UITraitCollection

The iOS interface environment for your app, defined by traits such as horizontal and vertical size class, display scale, and user interface idiom.

protocol UIAdaptivePresentationControllerDelegate

A set of methods that, in conjunction with a presentation controller, determine how to respond to trait changes in your app.

protocol UIContentContainer

A set of methods for adapting the contents of your view controllers to size and trait changes.