0

Is it possible to add a custom image page indicator on a Page view Controller native indicator?

If possible, help me how to do it ?

this is the reference image not the actual one

Vicky_Vignesh
  • 584
  • 2
  • 14

2 Answers2

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

Community
  • 1
  • 1
jignesh Vadadoriya
  • 3,244
  • 3
  • 18
  • 29
0

If you have page control ref then use

   let pageControl = UIPageControl.appearanceWhenContainedInInstancesOfClasses([ViewController.self])
   pageControl.pageIndicatorTintColor = UIColor.lightGrayColor()
   pageControl.currentPageIndicatorTintColor = UIColor.darkGrayColor()
Sanoj Kashyap
  • 5,020
  • 4
  • 49
  • 75