What properties can I set via an UIAppearance proxy?

17,312

Properties that can be set via UIAppearance are tagged with UI_APPEARANCE_SELECTOR in the corresponding header file.

To generate a list of properties tagged with UI_APPEARANCE_SELECTOR, you can use the following unix commands in a terminal:

cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer‌​/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/UIKit.framework/Headers
grep -H UI_APPEARANCE_SELECTOR ./* | sed 's/ __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0) UI_APPEARANCE_SELECTOR;//'

Here is a list that I compiled using the above commands. This is for the 5.0 SDK. The corresponding getter methods have been omitted for brevity.


UIActivityIndicatorView

@property (readwrite, nonatomic, retain) UIColor *color

UIBarButtonItem

@property(nonatomic,retain) UIColor *tintColor
- (void)setBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics
- (void)setBackgroundVerticalPositionAdjustment:(CGFloat)adjustment forBarMetrics:(UIBarMetrics)barMetrics 
- (void)setTitlePositionAdjustment:(UIOffset)adjustment forBarMetrics:(UIBarMetrics)barMetrics 
- (void)setBackButtonBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics
- (void)setBackButtonTitlePositionAdjustment:(UIOffset)adjustment forBarMetrics:(UIBarMetrics)barMetrics
- (void)setBackButtonBackgroundVerticalPositionAdjustment:(CGFloat)adjustment forBarMetrics:(UIBarMetrics)barMetrics 

[iOS 6.0]
- (void)setBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state style:(UIBarButtonItemStyle)style barMetrics:(UIBarMetrics)barMetrics [iOS 6.0]

UIBarItem

- (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state

UINavigationBar

@property(nonatomic,retain) UIColor *tintColor
@property(nonatomic,copy) NSDictionary *titleTextAttributes
- (void)setBackgroundImage:(UIImage *)backgroundImage forBarMetrics:(UIBarMetrics)barMetrics
- (void)setTitleVerticalPositionAdjustment:(CGFloat)adjustment forBarMetrics:(UIBarMetrics)barMetrics

[iOS 6.0]
@property(nonatomic,retain) UIImage *shadowImage

[iOS 7.0]
@property(nonatomic,retain) UIColor *barTintColor 
- (void)setBackgroundImage:(UIImage *)backgroundImage forBarPosition:(UIBarPosition)barPosition barMetrics:(UIBarMetrics)barMetrics 
- (UIImage *)backgroundImageForBarPosition:(UIBarPosition)barPosition barMetrics:(UIBarMetrics)barMetrics 
@property(nonatomic,retain) UIImage *backIndicatorImage 
@property(nonatomic,retain) UIImage *backIndicatorTransitionMaskImage 

UIPageControl

[iOS 6.0]
@property(nonatomic,retain) UIColor *pageIndicatorTintColor
@property(nonatomic,retain) UIColor *currentPageIndicatorTintColor

UIProgressView

@property(nonatomic, retain) UIColor* progressTintColor    
@property(nonatomic, retain) UIColor* trackTintColor    
@property(nonatomic, retain) UIImage* progressImage
@property(nonatomic, retain) UIImage* trackImage

UIRefreshControl

[iOS 6.0]
@property (nonatomic, retain) UIColor *tintColor
@property (nonatomic, retain) NSAttributedString *attributedTitle

UISearchBar

@property(nonatomic,retain) UIImage *backgroundImage
@property(nonatomic,retain) UIImage *scopeBarBackgroundImage
@property(nonatomic) UIOffset searchFieldBackgroundPositionAdjustment
@property(nonatomic) UIOffset searchTextPositionAdjustment
- (void)setSearchFieldBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state
- (void)setImage:(UIImage *)iconImage forSearchBarIcon:(UISearchBarIcon)icon state:(UIControlState)state
- (void)setScopeBarButtonBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state 
- (void)setScopeBarButtonDividerImage:(UIImage *)dividerImage forLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState
- (void)setScopeBarButtonTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state
- (void)setPositionAdjustment:(UIOffset)adjustment forSearchBarIcon:(UISearchBarIcon)icon

[iOS 7.0]
@property(nonatomic,retain) UIColor *barTintColor 
- (void)setBackgroundImage:(UIImage *)backgroundImage forBarPosition:(UIBarPosition)barPosition barMetrics:(UIBarMetrics)barMetrics 
- (UIImage *)backgroundImageForBarPosition:(UIBarPosition)barPosition barMetrics:(UIBarMetrics)barMetrics 

UISegmentedControl

@property(nonatomic,retain) UIColor *tintColor UI_APPEARANCE_SELECTOR;
- (void)setBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics 
- (void)setDividerImage:(UIImage *)dividerImage forLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState barMetrics:(UIBarMetrics)barMetrics
- (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state
- (void)setContentPositionAdjustment:(UIOffset)adjustment forSegmentType:(UISegmentedControlSegment)leftCenterRightOrAlone barMetrics:(UIBarMetrics)barMetrics

UISlider

@property(nonatomic,retain) UIColor *minimumTrackTintColor
@property(nonatomic,retain) UIColor *maximumTrackTintColor
@property(nonatomic,retain) UIColor *thumbTintColor

UIStepper

[iOS 6.0]
@property(nonatomic,retain) UIColor *tintColor
- (void)setBackgroundImage:(UIImage*)image forState:(UIControlState)state
- (void)setDividerImage:(UIImage*)image forLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState
- (void)setIncrementImage:(UIImage *)image forState:(UIControlState)state
- (void)setDecrementImage:(UIImage *)image forState:(UIControlState)state

UISwitch

@property(nonatomic, retain) UIColor* onTintColor

[iOS 6.0]
@property(nonatomic, retain) UIColor *tintColor
@property(nonatomic, retain) UIColor *thumbTintColor
@property(nonatomic, retain) UIImage *onImage
@property(nonatomic, retain) UIImage *offImage

UITabBar

@property(nonatomic,retain) UIColor *tintColor
@property(nonatomic,retain) UIColor *selectedImageTintColor
@property(nonatomic,retain) UIImage *backgroundImage
@property(nonatomic,retain) UIImage *selectionIndicatorImage

[iOS 6.0]
@property(nonatomic,retain) UIImage *shadowImage

[iOS 7.0]
@property(nonatomic,retain) UIColor *barTintColor 
@property(nonatomic) UITabBarItemPositioning itemPositioning 
@property(nonatomic) CGFloat itemWidth 
@property(nonatomic) CGFloat itemSpacing 
@property(nonatomic) UIBarStyle barStyle 

UITabBarItem

- (void)setTitlePositionAdjustment:(UIOffset)adjustment

UITableView

[iOS 6.0]
@property(nonatomic, retain) UIColor *sectionIndexColor
@property(nonatomic, retain) UIColor *sectionIndexTrackingBackgroundColor

[iOS 7.0]
@property (nonatomic) UIEdgeInsets separatorInset 
@property(nonatomic, retain) UIColor *sectionIndexBackgroundColor 

UITableViewCell

[iOS 7.0]
@property (nonatomic) UIEdgeInsets separatorInset 

UITableViewHeaderFooterView

[iOS 6.0]
@property(nonatomic, retain) UIColor *tintColor

UIToolbar

@property(nonatomic,retain) UIColor *tintColor;
- (void)setBackgroundImage:(UIImage *)backgroundImage forToolbarPosition:(UIToolbarPosition)topOrBottom barMetrics:(UIBarMetrics)barMetrics

[iOS 6.0]
- (void)setShadowImage:(UIImage *)shadowImage forToolbarPosition:(UIToolbarPosition)topOrBottom

[iOS 7.0]
@property(nonatomic,retain) UIColor *barTintColor 

(July 3, 2012): This list hasn't changed up til the most recent version of XCode (4.3.3).


(March 12, 2013): List updated for SDK 6.1. Properties that apply for iOS 6.0 (or greater) are listed under the [iOS 6.0] tag.


(Oct. 24, 2013): List updated for SDK 7.0. Properties that apply for iOS 7.0 (or greater) are listed under the [iOS 7.0] tag.

Share:
17,312

Related videos on Youtube

Emile Cormier
Author by

Emile Cormier

An electrical engineer that turned into a programmer. I'm the author of CppWAMP, a C++11 client library for the WAMP protocol.

Updated on January 18, 2020

Comments

  • Emile Cormier
    Emile Cormier over 4 years

    What properties can I set via an UIAppearance proxy? Apple's UIKit documentation does not list them. Is there a list of these properties?

  • Emile Cormier
    Emile Cormier about 12 years
    I'm surprised that UIButton doesn't have any UI_APPEARANCE_SELECTOR properties, yet conforms to the UIAppearance protocol. Is this an oversight by Apple?
  • Phillip Mills
    Phillip Mills about 12 years
    I've looked for such a list without finding it. The UI_APPEARANCE_SELECTOR macro doesn't seem to be the whole story either as UIView.h doesn't use it (5.0, at least) and yet the following code works: [[UIView appearance] setBackgroundColor:[UIColor redColor]];
  • Erik
    Erik almost 12 years
    With the App Store Xcode and iOS 5.1, the header path is now: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneO‌​S.platform/Developer‌​/SDKs/iPhoneOS5.1.sd‌​k/System/Library/Fra‌​meworks/UIKit.framew‌​ork/Headers
  • Pascal
    Pascal over 11 years
    Use xcode-select --print-path to get the path to the Developer directory.
  • Nic Wise
    Nic Wise over 11 years
    for XCode 4.5 it's: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneO‌​S.platform/Developer‌​/SDKs/iPhoneOS6.0.sd‌​k/System/Library/Fra‌​meworks/UIKit.framew‌​ork/Headers/
  • Lee Probert
    Lee Probert over 11 years
    and what about UITabBar setTitleTextAttributes ??
  • Lee Probert
    Lee Probert over 11 years
    this work s: [[UITabBarItem appearance] setTitleTextAttributes:tabBarItemOptions forState:UIControlStateNormal]; [[UITabBarItem appearance] setTitlePositionAdjustment:UIOffsetMake(0.0f, 2.0f) forBarMetrics:UIBarMetricsDefault];
  • Emile Cormier
    Emile Cormier over 11 years
    @LeeProbert: setTitleTextAttributes didn't exist back when I made the list. I would've thought that Apple would be properly documenting these by now.
  • Lee Probert
    Lee Probert over 11 years
    am doing quite a bit of work on this at the moment so will comment on anything I find out. Good work with the original list. Maybe a blog post?
  • David Rönnqvist
    David Rönnqvist over 11 years
    @PhillipMills that should probably be interpreted as "not officially supported". It may work but it's not guaranteed. It's similar to the fact that you can observe a lot of properties using KVO even though they aren't documented as fully KVO compliant. It may still work but there are no guarantees that the behaviour doesn't change or the it doesn't have issues.
  • Emile Cormier
    Emile Cormier about 11 years
    @MaciejSwic: Thanks, I'll try to update this answer during March break. What version SDK did you use to generated that list?
  • Hlung
    Hlung about 9 years
    Did you forget UILabel ?
  • Emile Cormier
    Emile Cormier about 9 years
    @Hlung: If UILabel has an UI_APPEARANCE_SELECTOR tag, then it must have been introduced in iOS 8. I'm no longer doing any iOS development, so someone else will have to update the answer for iOS 8.
  • Emile Cormier
    Emile Cormier about 9 years
    Geez, you'd think that Apple would have these properly documented by now. I bet that Apple's own employees are using this answer as a reference! :-P
  • Emile Cormier
    Emile Cormier about 9 years
    Making this a community wiki, as I'm no longer able to maintain it.
  • ThomasW
    ThomasW over 8 years
    UITextView textColor (and probably other properties) support the UIAppearance proxy, despite the properties not being marked as such.
  • Emile Cormier
    Emile Cormier over 8 years
    Perhaps we could add another section for properties that seemingly support UIAppearance proxy, despite not being documented as such. However, there should be a warning that support for those undocumented properties could change without notice. See @DavidRönnqvist 's comment above.