---
title: UIAppearance
framework: uikit
role: symbol
role_heading: Protocol
path: uikit/uiappearance
---

# UIAppearance

A collection of methods that gives you access to the appearance proxy for a class.

## Declaration

```swift
@MainActor protocol UIAppearance : NSObjectProtocol
```

## Overview

Overview You can customize the appearance of instances of a class by sending appearance-modification messages to the class’s appearance proxy. note: iOS applies appearance changes when a view enters a window, but it doesn’t change the appearance of a view that’s already in a window. To change the appearance of a view that’s currently in a window, remove the view from the view hierarchy and then put it back. 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 UINavigationBar: UINavigationBar.appearance().barTintColor = navBarTintColor To customize the appearances for instances of a class when contained within an instance of a container class, or instances in a hierarchy, use appearanceWhenContainedIn: to 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: let navigationBarAppearance = UINavigationBar.appearance(whenContainedInInstancesOf: [UINavigationController.self]) navigationBarAppearance.setBackgroundImage(navBarBackgroundImage, for: .any, barMetrics: .default)

let barButtonNavigationBarAppearance = UIBarButtonItem.appearance(whenContainedInInstancesOf: [UINavigationBar.self]) barButtonNavigationBarAppearance.setBackgroundImage(barButtonNavBarImage, for: .normal, barMetrics: .default)

let barButtonToolbarAppearance = UIBarButtonItem.appearance(whenContainedInInstancesOf: [UIToolbar.self]) barButtonToolbarAppearance.setBackgroundImage(barButtonToolbarImage, for: .normal, barMetrics: .default) 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’s 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(for:) and appearanceForTraitCollection:whenContainedIn: methods to retrieve the proxy for a class with the specified trait collection. To support appearance customization, a class must conform to the UIAppearanceContainer protocol and relevant accessor methods must be marked with UI_APPEARANCE_SELECTOR.

## Topics

### 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)

## Relationships

### Inherits From

- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

### Conforming Types

- [UIActionSheet](uikit/uiactionsheet.md)
- [UIActivityIndicatorView](uikit/uiactivityindicatorview.md)
- [UIAlertView](uikit/uialertview.md)
- [UIBackgroundExtensionView](uikit/uibackgroundextensionview.md)
- [UIBarButtonItem](uikit/uibarbuttonitem.md)
- [UIBarItem](uikit/uibaritem.md)
- [UIButton](uikit/uibutton.md)
- [UICalendarView](uikit/uicalendarview.md)
- [UICollectionReusableView](uikit/uicollectionreusableview.md)
- [UICollectionView](uikit/uicollectionview.md)
- [UICollectionViewCell](uikit/uicollectionviewcell.md)
- [UICollectionViewListCell](uikit/uicollectionviewlistcell.md)
- [UIColorWell](uikit/uicolorwell.md)
- [UIContentUnavailableView](uikit/uicontentunavailableview.md)
- [UIControl](uikit/uicontrol.md)
- [UIDatePicker](uikit/uidatepicker.md)
- [UIEventAttributionView](uikit/uieventattributionview.md)
- [UIImageView](uikit/uiimageview.md)
- [UIInputView](uikit/uiinputview.md)
- [UILabel](uikit/uilabel.md)
- [UIListContentView](uikit/uilistcontentview.md)
- [UINavigationBar](uikit/uinavigationbar.md)
- [UIPageControl](uikit/uipagecontrol.md)
- [UIPasteControl](uikit/uipastecontrol.md)
- [UIPickerView](uikit/uipickerview.md)
- [UIPopoverBackgroundView](uikit/uipopoverbackgroundview.md)
- [UIProgressView](uikit/uiprogressview.md)
- [UIRefreshControl](uikit/uirefreshcontrol.md)
- [UIScrollView](uikit/uiscrollview.md)
- [UISearchBar](uikit/uisearchbar.md)
- [UISearchTextField](uikit/uisearchtextfield.md)
- [UISegmentedControl](uikit/uisegmentedcontrol.md)
- [UISlider](uikit/uislider.md)
- [UIStackView](uikit/uistackview.md)
- [UIStandardTextCursorView](uikit/uistandardtextcursorview.md)
- [UIStepper](uikit/uistepper.md)
- [UISwitch](uikit/uiswitch.md)
- [UITabBar](uikit/uitabbar.md)
- [UITabBarItem](uikit/uitabbaritem.md)
- [UITableView](uikit/uitableview.md)
- [UITableViewCell](uikit/uitableviewcell.md)
- [UITableViewHeaderFooterView](uikit/uitableviewheaderfooterview.md)
- [UITextField](uikit/uitextfield.md)
- [UITextView](uikit/uitextview.md)
- [UIToolbar](uikit/uitoolbar.md)
- [UIView](uikit/uiview.md)
- [UIVisualEffectView](uikit/uivisualeffectview.md)
- [UIWebView](uikit/uiwebview.md)
- [UIWindow](uikit/uiwindow.md)

## See Also

### Appearance proxies

- [UIAppearanceContainer](uikit/uiappearancecontainer.md)
