-2

I have UIPageControl with 50+ pages (dots). And all these dots don't fit in width of the screen. Please tell me how to make it display only 5 - 7 dots, and current page (dot) in the center of scroll view, like Instagram when paging collection photos?

P. S. I need to use native UIPageControl, not custom UIVIew. Thanks!

Some like this

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • "I need to use native UIPageControl, not custom UIVIew" But what the screen shot shows is _not_ a native UIPageControl, so the question contradicts itself. – matt May 30 '18 at 18:54

1 Answers1

1

If I'm understanding you correctly, each of those dots correspond to their own page. and you just don't want them to excessively overflow on the bottom.

UIPageControl is not made to handle large amount of pages gracefully.

So you're going to want to create your own custom view subclass, and implement some sort of delegate to notify it when a new index is selected to adjust it's views.

I did some googling and it seems like you could steal inspiration from this Github Project: https://github.com/daria-kopaliani/DAPageControlView. Note that this uses a UICollectionView instead of a UIPageController though, if you truly wanted to keep using a UIPageController you'd need to hide the UIPageControl (Hide dots from UIPageViewController) and insert your own custom view at the bottom that does what you want, as I mentioned above.

gadu
  • 1,816
  • 1
  • 17
  • 31