思路是重写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 }

 

相关文章:

  • 2021-12-16
  • 2022-01-01
  • 2021-11-17
  • 2022-12-23
  • 2021-10-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案