UIPageControl
一、简介
<<分页控件是一种用来取代导航栏的可见指示器,方便手势直接翻页,最典型的应用便是iPhone的主屏幕,当图标过多会自动增加页面,在屏幕底部你会看到原点,用来只是当前页面,并且会随着翻页自动更新
<<继承关系:UIPageControl-->UIControl-->UIView-->UIResponder-->NSObject
格式为
1-->初始化(作用)
typedef NS_OPTIONS(NSUInteger, UIDataDetectorTypes) {
UIDataDetectorTypePhoneNumber = 1 << 0, //检测电话
UIDataDetectorTypeLink = 1 << 1, //检测网址和邮箱
UIDataDetectorTypeAddress NS_ENUM_AVAILABLE_IOS(4_0) = 1 << 2, // 检测地址
UIDataDetectorTypeCalendarEvent NS_ENUM_AVAILABLE_IOS(4_0) = 1 << 3, // 检测日历
UIDataDetectorTypeShipmentTrackingNumber NS_ENUM_AVAILABLE_IOS(10_0) = 1 << 4, // 货物追踪号码检测
UIDataDetectorTypeFlightNumber NS_ENUM_AVAILABLE_IOS(10_0) = 1 << 5, // 班机号码检测
UIDataDetectorTypeLookupSuggestion NS_ENUM_AVAILABLE_IOS(10_0) = 1 << 6, //用户可能要查找的信息
UIDataDetectorTypeNone = 0, // 禁用检测
UIDataDetectorTypeAll = NSUIntegerMax // 检测所有类型链接
} __TVOS_PROHIBITED;
;(如果属性有枚举类型的话,这里会有枚举类型说明)
self.webView.dataDetectorTypes =UIDataDetectorTypeAll;(这是具体的例子)
@property (nonatomic) UIDataDetectorTypes dataDetectorTypes NS_AVAILABLE_IOS(3_0);// UITextField 设置提示文字 (这是说明)
二、UIPageControl的文本属性(属性的顺序与苹果API一致)
1-->设置页面数目
myPageControl.numberOfPages =5;
@property(nonatomic) NSInteger numberOfPages; // 默认是 0
2-->指定pagecontroll的值,默认选中的小白点
myPageControl.currentPage =3;// 当前页数,第四页
@property(nonatomic) NSInteger currentPage; // 默认是0(第一个)
3-->设置如果要在仅有一个页面的情况下隐藏指示器
myPageControl.hidesForSinglePage=YES;
@property(nonatomic) BOOL hidesForSinglePage; /默认是NO
4-->设置是否延迟自动更新控制器的当前页码(默认为NO)
myPageControl.defersCurrentPageDisplay = YES;
@property(nonatomic) BOOL defersCurrentPageDisplay;
5-->更新当前页
[myPageControl updateCurrentPageDisplay];
- (void)updateCurrentPageDisplay; // update page display to match the currentPage. ignored if defersCurrentPageDisplay is NO. setting the page value directly will update immediately
6-->通过页数得到控制器大小
CGSize size = [_pageControl sizeForNumberOfPages:kImageCount];
- (CGSize)sizeForNumberOfPages:(NSInteger)pageCount;
7-->设置 小圆圈的颜色
page.pageIndicatorTintColor = [UIColor orangeColor];
@property(nullable, nonatomic,strong) UIColor *pageIndicatorTintColor NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;
8-->设置 选中的小圆圈的颜色
page.currentPageIndicatorTintColor = [UIColor redColor];
@property(nullable, nonatomic,strong) UIColor *currentPageIndicatorTintColor NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;