UI 常用方法總結之--- UIPageControl

UIPageControl : UIControl

 

1.創建一個UIPageControl對象

UIPageControl *pageControl = [[UIPageControl alloc]initWithFrame:CGRectMake(20, 20, 280, 50)]; 

 

2.backgroundColor

背景顏色

 

3.numberOfPages

顯示的頁數控制()

eg:pageControl.numberOfPages = 10;

 

4.currentPageIndicatorTintColor

當前點的顏色

eg:pageControl.currentPageIndicatorTintColor = [UIColor yellowColor];

 

5.pageIndicatorTintColor

未被選中點的顏色

eg:pageControl.pageIndicatorTintColor = [UIColor greenColor];

 

6.- (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents;

使用UIControlEventValueChanged

 

7.常用綁定方法

    CGFloat xoffset = pageControl.currentPage *280;

    CGPoint offset = CGPointMake(xoffset, 0);

    [self.scrollView setContentOffset:offset animated:YES];

    self.scrollView.contentOffset = offset;

 

    //計算scrollView的偏移量

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章