Skip to content

Instantly share code, notes, and snippets.

@mattt
Last active September 24, 2024 12:59
Show Gist options
  • Save mattt/5135521 to your computer and use it in GitHub Desktop.
Save mattt/5135521 to your computer and use it in GitHub Desktop.
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
  sed 's/UI_APPEARANCE_SELECTOR//g'   | \
  sed 's/__TVOS_PROHIBITED//g'        | \
  sed 's/@property (/@property(/g'    | \
  awk -F"\.h:"                          \
      'BEGIN {
          print "# UIAppearance Selectors\n"
       }
       $1!= header && NR > 1 {
           print "```"
       };
       $1!= header {
           print "\n## " $1 "\n\n```objc"
       };
       header = $1;
       END {
           print "```\n"
       }'                             | \
  sed 's/## .\//## /g'                | \
  sed 's/.*\.h://g'                   | \
  sed 's/[ ]\{2,\}/ /g'               | \
  sed 's/[ ]*;/;/g'                   | \
  sed 's/ \/\/.*$//'

UIAppearance Selectors

UIActivityIndicatorView

@property(nullable, readwrite, nonatomic, strong) UIColor *color;

UIAppearance

/* To participate in the appearance proxy API, tag your appearance property selectors in your header with .
#define __attribute__((annotate("ui_appearance_selector")))

UIBarButtonItem

- (void)setBackgroundImage:(nullable UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics;
- (nullable UIImage *)backgroundImageForState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics;
- (void)setBackgroundImage:(nullable UIImage *)backgroundImage forState:(UIControlState)state style:(UIBarButtonItemStyle)style barMetrics:(UIBarMetrics)barMetrics;
- (nullable UIImage *)backgroundImageForState:(UIControlState)state style:(UIBarButtonItemStyle)style barMetrics:(UIBarMetrics)barMetrics;
- (void)setBackgroundVerticalPositionAdjustment:(CGFloat)adjustment forBarMetrics:(UIBarMetrics)barMetrics; 
- (CGFloat)backgroundVerticalPositionAdjustmentForBarMetrics:(UIBarMetrics)barMetrics;
- (void)setTitlePositionAdjustment:(UIOffset)adjustment forBarMetrics:(UIBarMetrics)barMetrics; 
- (UIOffset)titlePositionAdjustmentForBarMetrics:(UIBarMetrics)barMetrics;
- (void)setBackButtonBackgroundImage:(nullable UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics;
- (nullable UIImage *)backButtonBackgroundImageForState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics;
- (void)setBackButtonTitlePositionAdjustment:(UIOffset)adjustment forBarMetrics:(UIBarMetrics)barMetrics;
- (UIOffset)backButtonTitlePositionAdjustmentForBarMetrics:(UIBarMetrics)barMetrics;
- (void)setBackButtonBackgroundVerticalPositionAdjustment:(CGFloat)adjustment forBarMetrics:(UIBarMetrics)barMetrics;
- (CGFloat)backButtonBackgroundVerticalPositionAdjustmentForBarMetrics:(UIBarMetrics)barMetrics;

UIBarItem

- (void)setTitleTextAttributes:(nullable NSDictionary<NSAttributedStringKey,id> *)attributes forState:(UIControlState)state;
- (nullable NSDictionary<NSString *,id> *)titleTextAttributesForState:(UIControlState)state;

UIButton

@property(nonatomic) UIEdgeInsets contentEdgeInsets;
- (void)setTitleColor:(nullable UIColor *)color forState:(UIControlState)state;
- (void)setTitleShadowColor:(nullable UIColor *)color forState:(UIControlState)state;
- (void)setBackgroundImage:(nullable UIImage *)image forState:(UIControlState)state;

UINavigationBar

@property(nonatomic,assign) UIBarStyle barStyle;
@property(nonatomic,assign,getter=isTranslucent) BOOL translucent;
@property(nonatomic, readwrite, assign) BOOL prefersLargeTitles;
@property(nullable, nonatomic,strong) UIColor *barTintColor;
- (void)setBackgroundImage:(nullable UIImage *)backgroundImage forBarPosition:(UIBarPosition)barPosition barMetrics:(UIBarMetrics)barMetrics;
- (nullable UIImage *)backgroundImageForBarPosition:(UIBarPosition)barPosition barMetrics:(UIBarMetrics)barMetrics;
- (void)setBackgroundImage:(nullable UIImage *)backgroundImage forBarMetrics:(UIBarMetrics)barMetrics;
- (nullable UIImage *)backgroundImageForBarMetrics:(UIBarMetrics)barMetrics;
@property(nullable, nonatomic,strong) UIImage *shadowImage;
@property(nullable,nonatomic,copy) NSDictionary<NSAttributedStringKey, id> *titleTextAttributes;
@property(nullable, nonatomic, copy) NSDictionary<NSAttributedStringKey, id> *largeTitleTextAttributes;
- (void)setTitleVerticalPositionAdjustment:(CGFloat)adjustment forBarMetrics:(UIBarMetrics)barMetrics;
- (CGFloat)titleVerticalPositionAdjustmentForBarMetrics:(UIBarMetrics)barMetrics;
@property(nullable,nonatomic,strong) UIImage *backIndicatorImage;
@property(nullable,nonatomic,strong) UIImage *backIndicatorTransitionMaskImage;

UIPageControl

@property(nullable, nonatomic,strong) UIColor *pageIndicatorTintColor;
@property(nullable, nonatomic,strong) UIColor *currentPageIndicatorTintColor;

UIProgressView

@property(nonatomic, strong, nullable) UIColor* progressTintColor;
@property(nonatomic, strong, nullable) UIColor* trackTintColor;
@property(nonatomic, strong, nullable) UIImage* progressImage;
@property(nonatomic, strong, nullable) UIImage* trackImage;

UIRefreshControl

@property(nullable, nonatomic, strong) NSAttributedString *attributedTitle;

UISearchBar

@property(nullable, nonatomic,strong) UIColor *barTintColor;
@property(nullable, nonatomic,strong) UIImage *backgroundImage;
@property(nullable, nonatomic,strong) UIImage *scopeBarBackgroundImage;
- (void)setBackgroundImage:(nullable UIImage *)backgroundImage forBarPosition:(UIBarPosition)barPosition barMetrics:(UIBarMetrics)barMetrics;
- (nullable UIImage *)backgroundImageForBarPosition:(UIBarPosition)barPosition barMetrics:(UIBarMetrics)barMetrics;
- (void)setSearchFieldBackgroundImage:(nullable UIImage *)backgroundImage forState:(UIControlState)state;
- (nullable UIImage *)searchFieldBackgroundImageForState:(UIControlState)state;
- (void)setImage:(nullable UIImage *)iconImage forSearchBarIcon:(UISearchBarIcon)icon state:(UIControlState)state;
- (nullable UIImage *)imageForSearchBarIcon:(UISearchBarIcon)icon state:(UIControlState)state;
- (void)setScopeBarButtonBackgroundImage:(nullable UIImage *)backgroundImage forState:(UIControlState)state; 
- (nullable UIImage *)scopeBarButtonBackgroundImageForState:(UIControlState)state;
- (void)setScopeBarButtonDividerImage:(nullable UIImage *)dividerImage forLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState;
- (nullable UIImage *)scopeBarButtonDividerImageForLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState;
- (void)setScopeBarButtonTitleTextAttributes:(nullable NSDictionary<NSString *, id> *)attributes forState:(UIControlState)state;
- (nullable NSDictionary<NSString *, id> *)scopeBarButtonTitleTextAttributesForState:(UIControlState)state;
@property(nonatomic) UIOffset searchFieldBackgroundPositionAdjustment;
@property(nonatomic) UIOffset searchTextPositionAdjustment;
- (void)setPositionAdjustment:(UIOffset)adjustment forSearchBarIcon:(UISearchBarIcon)icon;
- (UIOffset)positionAdjustmentForSearchBarIcon:(UISearchBarIcon)icon;

UISegmentedControl

- (void)setBackgroundImage:(nullable UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics; 
- (nullable UIImage *)backgroundImageForState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics;
- (void)setDividerImage:(nullable UIImage *)dividerImage forLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState barMetrics:(UIBarMetrics)barMetrics;
- (nullable UIImage *)dividerImageForLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState barMetrics:(UIBarMetrics)barMetrics;
- (void)setTitleTextAttributes:(nullable NSDictionary *)attributes forState:(UIControlState)state;
- (nullable NSDictionary *)titleTextAttributesForState:(UIControlState)state;
- (void)setContentPositionAdjustment:(UIOffset)adjustment forSegmentType:(UISegmentedControlSegment)leftCenterRightOrAlone barMetrics:(UIBarMetrics)barMetrics; 
- (UIOffset)contentPositionAdjustmentForSegmentType:(UISegmentedControlSegment)leftCenterRightOrAlone barMetrics:(UIBarMetrics)barMetrics;

UISlider

@property(nullable, nonatomic,strong) UIColor *minimumTrackTintColor;
@property(nullable, nonatomic,strong) UIColor *maximumTrackTintColor;
@property(nullable, nonatomic,strong) UIColor *thumbTintColor;

UIStepper

- (void)setBackgroundImage:(nullable UIImage*)image forState:(UIControlState)state;
- (nullable UIImage*)backgroundImageForState:(UIControlState)state;
- (void)setDividerImage:(nullable UIImage*)image forLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState;
- (nullable UIImage*)dividerImageForLeftSegmentState:(UIControlState)state rightSegmentState:(UIControlState)state;
- (void)setIncrementImage:(nullable UIImage *)image forState:(UIControlState)state;
- (nullable UIImage *)incrementImageForState:(UIControlState)state;
- (void)setDecrementImage:(nullable UIImage *)image forState:(UIControlState)state;
- (nullable UIImage *)decrementImageForState:(UIControlState)state;

UISwitch

@property(nullable, nonatomic, strong) UIColor *onTintColor;
@property(nullable, nonatomic, strong) UIColor *thumbTintColor;
@property(nullable, nonatomic, strong) UIImage *onImage;
@property(nullable, nonatomic, strong) UIImage *offImage;

UITabBar

@property(nullable, nonatomic, strong) UIColor *barTintColor;
@property(nonatomic, readwrite, copy, nullable) UIColor *unselectedItemTintColor;
@property(nullable, nonatomic, strong) UIColor *selectedImageTintColor;
@property(nullable, nonatomic, strong) UIImage *backgroundImage;
@property(nullable, nonatomic, strong) UIImage *selectionIndicatorImage;
@property(nullable, nonatomic, strong) UIImage *shadowImage;
@property(nonatomic) UITabBarItemPositioning itemPositioning;
@property(nonatomic) CGFloat itemWidth;
@property(nonatomic) CGFloat itemSpacing;
@property(nonatomic) UIBarStyle barStyle;

UITabBarItem

@property(nonatomic, readwrite, assign) UIOffset titlePositionAdjustment;
@property(nonatomic, readwrite, copy, nullable) UIColor *badgeColor;
- (void)setBadgeTextAttributes:(nullable NSDictionary<NSString *,id> *)textAttributes forState:(UIControlState)state;
- (nullable NSDictionary<NSString *,id> *)badgeTextAttributesForState:(UIControlState)state;

UITableView

@property(nonatomic) UIEdgeInsets separatorInset;
@property(nonatomic, strong, nullable) UIColor *sectionIndexColor;
@property(nonatomic, strong, nullable) UIColor *sectionIndexBackgroundColor;
@property(nonatomic, strong, nullable) UIColor *sectionIndexTrackingBackgroundColor;
@property(nonatomic, strong, nullable) UIColor *separatorColor;
@property(nonatomic, copy, nullable) UIVisualEffect *separatorEffect;

UITableViewCell

@property(nonatomic) UIEdgeInsets separatorInset;
@property(nonatomic) UITableViewCellFocusStyle focusStyle;

UIToolbar

@property(nonatomic) UIBarStyle barStyle;
@property(nonatomic,assign,getter=isTranslucent) BOOL translucent;
@property(nullable, nonatomic, strong) UIColor *barTintColor;
- (void)setBackgroundImage:(nullable UIImage *)backgroundImage forToolbarPosition:(UIBarPosition)topOrBottom barMetrics:(UIBarMetrics)barMetrics;
- (nullable UIImage *)backgroundImageForToolbarPosition:(UIBarPosition)topOrBottom barMetrics:(UIBarMetrics)barMetrics;
- (void)setShadowImage:(nullable UIImage *)shadowImage forToolbarPosition:(UIBarPosition)topOrBottom;
- (nullable UIImage *)shadowImageForToolbarPosition:(UIBarPosition)topOrBottom;

UIView

@property(nullable, nonatomic,copy) UIColor *backgroundColor;
@guoweimo
Copy link

amazing!

@Grubas7
Copy link

Grubas7 commented Apr 25, 2016

UITextView.appearance().linkTextAttributes works as well.

@cute
Copy link

cute commented Jul 29, 2016

cool!

@vrahos
Copy link

vrahos commented Sep 25, 2016

UILabel also has setFont, useful for UILabel contained in UIButton instances to style the buttons font.

@daxiazhou
Copy link

cool!

@twinsen2848
Copy link

Thank you very much !!

@prajwal-udupa
Copy link

helped! Thanks..

@dehesa
Copy link

dehesa commented Oct 26, 2018

Thank you. Very helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment