A collection of methods that gives you access to the appearance proxy for a class.
- iOS 5.0+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
You can customize the appearance of instances of a class by sending appearance modification messages to the class’s appearance proxy.
There are two ways to customize appearance for objects: for all instances, and for instances contained within an instance of a container class.
To customize the appearance of all instances of a class, use
appearance()to get the appearance proxy for the class. For example, to modify the bar background tint color for all instances of
To customize the appearances for instances of a class when contained within an instance of a container class, or instances in a hierarchy, use
appearanceto get the appearance proxy for the class. For example, to modify the appearance of bar buttons, based on the object that contains the navigation bar:
When Contained In:
In any given view hierarchy, the outermost appearance proxy wins. Specificity (depth of the chain) is the tie-breaker. In other words, the containment statement in
appearance is treated as a partial ordering. Given a concrete ordering (actual subview hierarchy), UIKit selects the partial ordering that is the first unique match when reading the actual hierarchy from the window down.
You can further refine which instances of a class will have their appearance customized by specifying a trait collection. Use the
appearance methods to retrieve the proxy for a class with the specified trait collection.