答案 0 :(得分:0)
If you normally want to change color of indicator then you can change directly color there is no need to change image by this way
let pageVC = UIPageControl()
pageVC.currentPageIndicatorTintColor = UIColor.red
pageVC.tintColor = UIColor.green
But you want to change the image of PageIndicator
then try this link:-
Answer with GrayPageControl:- Is there a way to change page indicator dots color
It is really good and reliable.I also have used this code.
You might have to do some more customization as
-(void) updateDots
{
for (int i = 0; i < [self.subviews count]; i++)
{
UIImageView* dot = [self.subviews objectAtIndex:i];
if (i == self.currentPage) {
if(i==0) {
dot.image = [UIImage imageNamed:@"activesearch.png"];
} else {
dot.image = activeImage;
}
} else {
if(i==0) {
dot.image = [UIImage imageNamed:@"inactivesearch.png"];
} else {
dot.image = inactiveImage;
}
}
}
}
Hope it will help you
答案 1 :(得分:0)
If you have page control ref then use
let pageControl = UIPageControl.appearanceWhenContainedInInstancesOfClasses([ViewController.self])
pageControl.pageIndicatorTintColor = UIColor.lightGrayColor()
pageControl.currentPageIndicatorTintColor = UIColor.darkGrayColor()