Pagination dots are not coming up in iOS 14

Viewed 1144

I was working on pagination , I see that there page control is not coming up for iOS 14 , where for iOS 13 and below is visible .. Can some one please help me out on this

func designPageControl() {
    pageControl.numberOfPages = 4
    pageControl.isUserInteractionEnabled = true
    self.pageControl.addTarget(self, action:#selector(didChangePage), for: UIControl.Event.touchUpInside)
    self.pageControl.transform = CGAffineTransform(scaleX: 1.3, y: 1.3)
    pageControl.frame = CGRect(x: self.view.frame.midX - 50, y: self.view.frame.maxY - 90, width: 100, height: 100)
    self.view.addSubview(pageControl)
    self.pageControl.pageIndicatorTintColor =  UIColor(named: "GS-50")
    pageControl.currentPageIndicatorTintColor = UIColor(named: "PB-100")
}
2 Answers

Give the leading and trailing constraint to 20,20 and try.It worked for me. Dots size is increased in iOS 14.

I had the same problem (UIPageControl added programmatically was not showing up under iOS 14.x, but okay under prior iOS).

In Objective-C, adding:

 [pageControl sizeToFit];

before calling addSubView did the trick for me. In Swift, it would be:

pageControl.sizeToFit
Related