0
我有我已經定製了點顏色沒有改變Custome UIPageControl圓點的顏色不改變
- (void)drawRect:(CGRect)rect {
if (hidesForSinglePage == NO || [self numberOfPages] > 1){
if (activePageColor == nil){
activePageColor = [UIColor blackColor];
}
if (inactivePageColor == nil){
inactivePageColor = [UIColor grayColor];
}
CGContextRef context = UIGraphicsGetCurrentContext();
// float dotSize = self.frame.size.height/6;
float dotSize = self.frame.size.height/2;
float dotsWidth = (dotSize * [self numberOfPages]) + (([self numberOfPages] - 1) 10);
float offset = (self.frame.size.width - dotsWidth)/2;
for (NSInteger i = 0; i < [self numberOfPages]; i++){
if (i == [self currentPage]){
CGContextSetFillColorWithColor(context, [activePageColor CGColor]);
} else {
CGContextSetFillColorWithColor(context, [inactivePageColor CGColor]);
}
CGContextStrokeEllipseInRect(context, CGRectMake(offset + (dotSize + 10) * i,(self.frame.size.height/2) - (dotSize/2), dotSize, dotSize));
}
}
UIPageControl如果我改變CGContextStrokeEllipseInRect與CGContextFillEllipseInRect那麼它的改變,但我想用CGContextStrokeEllipseInRect