Instance Method

overrideTraitCollection(forChild:)

Retrieves the trait collection for a child view controller.

Declaration

func overrideTraitCollection(forChild childViewController: UIViewController) -> UITraitCollection?

Parameters

childViewController

The view controller who’s trait collection is to be returned.

Return Value

The trait collection for the designated view controller.

Discussion

Use this method to retrieve the trait collection for a child view controller. You can then modify the trait collection for the designated child view controller and set it using the setOverrideTraitCollection(_:forChild:) method.

See Also

Managing Child View Controllers in a Custom Container

var children: [UIViewController]

An array of view controllers that are children of the current view controller.

func addChild(UIViewController)

Adds the specified view controller as a child of the current view controller.

func removeFromParent()

Removes the view controller from its parent.

var shouldAutomaticallyForwardAppearanceMethods: Bool

Returns a Boolean value indicating whether appearance methods are forwarded to child view controllers.

func beginAppearanceTransition(Bool, animated: Bool)

Tells a child controller its appearance is about to change.

func endAppearanceTransition()

Tells a child controller its appearance has changed.

func setOverrideTraitCollection(UITraitCollection?, forChild: UIViewController)

Changes the traits assigned to the specified child view controller.

class let hierarchyInconsistencyException: NSExceptionName

Raised if the view controller hierarchy is inconsistent with the view hierarchy.