UIPageControl--改变分页指示圆点的大小

思路是重写UIPageControl的setCurrentPage:方法,  代码如下:

 1 /**
 2  *  改变pageControl中点的大小
 3  */
 4 - (void)setCurrentPage:(NSInteger)page {
 5     [super setCurrentPage:page];
 6     for (NSUInteger subviewIndex = 0; subviewIndex < [self.subviews count]; subviewIndex++) {
 7         UIImageView* subview = [self.subviews objectAtIndex:subviewIndex];
 8         CGSize size;
 9         size.height = ZJHomeTopPageControlWH;
10         size.width = ZJHomeTopPageControlWH;
11         [subview setFrame:CGRectMake(subview.frame.origin.x, subview.frame.origin.y, size.width,size.height)];
12         if (subviewIndex == page) {
13             [subview setBackgroundColor:self.currentPageIndicatorTintColor];
14         } else {
15             [subview setBackgroundColor:self.pageIndicatorTintColor];
16         }
17     }
18 }

 

posted @ 2014-11-15 17:24  lYcHeeM  阅读(1413)  评论(0编辑  收藏  举报