概述
页码显式控件,用来显示总共页码和当前页码,操作控件时,每次在水平方向上只能前进(后退)一页(点)
UIPageControl
appearance
@property(nonatomic) BOOL hidesForSinglePage; // hide the the indicator if there is only one page. default is NO
@property(nullable, nonatomic,strong) UIColor *pageIndicatorTintColor NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;
@property(nullable, nonatomic,strong) UIColor *currentPageIndicatorTintColor NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;
@property(nonatomic) BOOL defersCurrentPageDisplay; // if set, clicking to a new page won't update the currently displayed page until -updateCurrentPageDisplay is called. default is NO
- (void)updateCurrentPageDisplay; // update page display to match the currentPage. ignored if defersCurrentPageDisplay is NO. setting the page value directly will update immediately
- (CGSize)sizeForNumberOfPages:(NSInteger)pageCount; // returns minimum size required to display dots for given page count. can be used to size control if page count could change
注意:
- pageIndicatorTintColor非当前页点颜色,currentPageIndicatorTintColor当前页点颜色
- defersCurrentPageDisplay推迟当前页更新,defersCurrentPageDisplay为YES时,当控件上滑动改变当前页时,UI不会更新,直至调用updateCurrentPageDisplay UI才更新,默认为NO,如果直接代码改变currentPage时,UI立即更新
- sizeForNumberOfPages获取需要容纳pageCount个页(点)所需要的最小size
page
@property(nonatomic) NSInteger numberOfPages; // default is 0
@property(nonatomic) NSInteger currentPage; // default is 0. value pinned to 0..numberOfPages-1
event-target-action
UIPageControl的currentPage changed,UIControlEventValueChanged triggering