UIPageControl(页码控制器)

1.创建一个页码控制器(小圆点)

   UIPageControl *pc = [[UIPageControl alloc] initWithFrame:CGRectMake(,,,)];

2.小圆点的个数

     pc.numberOfPages = 3;

     pc.userInteractionEnabled = NO;

3.设置小点点的颜色

     pc.currentPageIndicatorTintColor = [UIColor ...];//当前图的颜色

     pc.pageIndicatorTintColor = [UIColor ....];

4.//sv停止滑行时触发
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    NSLog(@"==%@",NSStringFromCGPoint(scrollView.contentOffset));
    
    UIPageControl *pc = (UIPageControl *)[self.view viewWithTag:1];
    
    pc.currentPage = scrollView.contentOffset.x / scrollView.frame.size.width;
    //根据x方向的偏移量计算当前是在第几页,然后让对应的小圆点亮起来

}

posted @ 2015-04-02 20:39  Angelone  阅读(285)  评论(0编辑  收藏  举报