会自动生成frame,可以设置其中心点center 来布局
@property(nonatomic) NSInteger numberOfPages;
@property(nonatomic) NSInteger currentPage;
设置页数通过numberOfPages属性设置,
currentPage 当前选中页面
currentPageIndicatorTintColor 当前页的圆点颜色
pageIndicatorTintColor 非当前页面圆点颜色
UIPageControl 的示例代码
UIPageControl *pageControl = [[UIPageControl alloc] init];
pageControl.numberOfPages = 3;
pageControl.centerX = self.view.width * 0.5;
pageControl.centerY = self.view.height - 30;
[self.view addSubview:pageControl];
// 2.设置圆点的颜色
pageControl.currentPageIndicatorTintColor = [UIColor orangeColor]; // 当前页的小圆点颜色
pageControl.pageIndicatorTintColor = [UIColor lightGrayColor]; // 非当前页的小圆点颜色