Home > other >  Swift How to Show All Dots in PageControl
Swift How to Show All Dots in PageControl

Time:04-06

I have 3 pages, but the dots viewed just 2

Hello, in this app i have 3 pages (index 0 - 2). But how the PageControl just show 2 pages? How can I show all dots of pages in my page control?

thank you :)

CodePudding user response:

It appears from the GIF as if all three pages are present in your UIPageControl, but only the first two corresponding dots are actually being displayed.

To fix it, just add this:

pageControl.sizeToFit()

inside your view controller's viewDidLoad.

This will cause the page control to expand to display as many dots as pages exist.

  • Related