iOS 调整UIPageControl圆点大小

创建一个类,继承UIPageControl,重写setCurrentPage方法,可设置圆点大小,用这个类来初始化pageControl使用即可。

#import 

@interface MyPageControl : UIPageControl

@end

#import "MyPageControl.h"

@implementation MyPageControl

//重写setCurrentPage方法,可设置圆点大小
- (void) setCurrentPage:(NSInteger)page {
    [super setCurrentPage:page];
    
    for (NSUInteger subviewIndex = 0; subviewIndex < [self.subviews count]; subviewIndex++) {
        UIImageView* subview = [self.subviews objectAtIndex:subviewIndex];
        CGSize size;
        size.height = 5;
        size.width = 5;
        [subview setFrame:CGRectMake(subview.frame.origin.x, subview.frame.origin.y,
                                     size.width,size.height)];
    }
}

@end


你可能感兴趣的:(UI)