自定义PageControl样式
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了自定义PageControl样式相关的知识,希望对你有一定的参考价值。
#define ios7 ([[UIDevice currentDevice].systemVersion doubleValue] >= 7.0) //调用方法 改变PageControl样式 [self changePageControlImage:self.detailPageControl]; //改变pagecontrol中圆点样式 - (void)changePageControlImage:(UIPageControl *)pageControl{ static UIImage *currentImage = nil; static UIImage *otherImage = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ currentImage = [UIImage imageNamed:@"dot"]; otherImage = [UIImage imageNamed:@"dotk"]; }); if (iOS7) { [pageControl setValue:currentImage forKey:@"_currentPageImage"]; [pageControl setValue:otherImage forKey:@"_pageImage"]; } else { for (int i = 0;i < self.thubmImageArray.count; i++) { UIImageView *imageVieW = [pageControl.subviews objectAtIndex:i]; imageVieW.frame = CGRectMake(imageVieW.frame.origin.x, imageVieW.frame.origin.y, 20, 20); imageVieW.image = pageControl.currentPage == i ? currentImage : otherImage; } } } [email protected] [email protected]
以上是关于自定义PageControl样式的主要内容,如果未能解决你的问题,请参考以下文章