UIPageControl

 
    UIPageControl * pageControl = [[UIPageControl alloc]initWithFrame:CGRectMake(10, [[UIScreen mainScreen] bounds].size.height - 40, 300, 20)];
    pageControl.backgroundColor = [UIColor whiteColor];
    
    pageControl.tag = 100;
  

设置表示的页数
    pageControl.numberOfPages = 6;
    
 

设置当前选中的点
    pageControl.currentPage = 0;
    
 

设置未选中点的颜色
    pageControl.pageIndicatorTintColor = [UIColor greenColor];
 


设置选中点的颜色
    pageControl.currentPageIndicatorTintColor = [UIColor redColor];
    
 

添加响应事件
    [pageControl addTarget:self action:@selector(pageControl:) forControlEvents:UIControlEventTouchUpInside];
    [pageControl addTarget:self action:@selector(pageControlValue) forControlEvents:UIControlEventValueChanged];
    
    [self.view addSubview:pageControl];
    [pageControl release];

}

你可能感兴趣的:(PageControl)