UIPageControl + UIAppearance

2019-05-04 22:27发布

问题:

The docs for UIAppearance is extremely poor.

I want to customize the colours for a UIPageController, but I am unable to figure out which properties to set. When I go [UIPagecontrol appearance] set I get probably hundreds of options, so it's nearly impossible to figure out what's what.

I would assume it's possible with UIAppearance proxy, right?

Thank you

回答1:

UIAppearance protocol was added to UIPageControl as of iOS 6.

The properties you can customise are:

  • Dot tint colour
  • Highlighted dot tint colour

This is an excerpt from UIPageControl.h, as you can see these UIAppearance additions are only available from iOS 6.

@property(nonatomic,retain) UIColor *pageIndicatorTintColor NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;
@property(nonatomic,retain) UIColor *currentPageIndicatorTintColor NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;