---
title: "appearanceWhenContainedIn:"
framework: uikit
role: symbol
role_heading: Type Method
path: "uikit/uiappearance/appearancewhencontainedin:"
---

# appearanceWhenContainedIn:

Returns the appearance proxy for object when it’s contained in the hierarchy the specified classes describe.

## Declaration

```occ
+ (instancetype) appearanceWhenContainedIn:(Class<UIAppearanceContainer> *) ContainerClass;
```

## Parameters

- `ContainerClass`: A nil-terminated list of appearance container classes, in ascending hierarchical order.

## Return Value

Return Value The appearance proxy to use for the object.

## Discussion

Discussion Set the ContainerClass array to an ascending hierarchical list of containing types. For example, if you want a navigation bar to take on a specific appearance when contained in a navigation controller inside a tab bar controller, set ContainerClass to @[[UINavigationController class], [UITabBarController class], nil]. Do not set ContainerClass to an unrelated list of types or to a list that does not match the containment hierarchy of your user interface. 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.

## See Also

### Working with the appearance proxy

- [appearance()](uikit/uiappearance/appearance().md)
- [appearance(for:)](uikit/uiappearance/appearance(for:).md)
- [appearance(whenContainedInInstancesOf:)](uikit/uiappearance/appearance(whencontainedininstancesof:).md)
- [appearance(for:whenContainedInInstancesOf:)](uikit/uiappearance/appearance(for:whencontainedininstancesof:).md)
- [appearanceForTraitCollection:whenContainedIn:](uikit/uiappearance/appearancefortraitcollection:whencontainedin:.md)
