UIAppearance Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/UIKit.framework
Availability
Available in iOS 5.0 and later.
Declared in
UIAppearance.h

Overview

Use the UIAppearance protocol to get the appearance proxy for a class. 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.

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 appearanceWhenContainedIn: 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.

To support appearance customization, a class must conform to the UIAppearanceContainer protocol and relevant accessor methods must be marked with UI_APPEARANCE_SELECTOR.

Tasks

Appearance Methods

Class Methods

appearance

Returns the appearance proxy for the receiver. (required)

+ (instancetype)appearance
Return Value

The appearance proxy for the receiver.

Availability
  • Available in iOS 5.0 and later.
Declared In
UIAppearance.h

appearanceWhenContainedIn:

Returns the appearance proxy for the receiver in a given containment hierarchy. (required)

+ (instancetype)appearanceWhenContainedIn:(Class <UIAppearanceContainer>)ContainerClass,...
Parameters
ContainerClass,

A nil-terminated list of appearance container classes.

Return Value

The appearance proxy for the receiver in a given containment hierarchy.

Discussion

This method throws an exception for any item in the var-args list that is not a Class object that conforms to the UIAppearanceContainer protocol.

Availability
  • Available in iOS 5.0 and later.
Declared In
UIAppearance.h