Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: Remove padding in UIPageControl

Tags:

html

ios

swift

I have an app with compatibility from iOS 12 to 14 and have a problem with the page control. On iOS 14 it has a huge padding which it doesn't have in older iOS version. Interface builder also shows this padding. My Problem is that I don't want this because my page control is not centred but left aligned in the UI.

enter image description here

How can I remove the padding so that it looks identically on all iOS versions?

like image 890
netshark1000 Avatar asked Jan 25 '23 12:01

netshark1000


1 Answers

This issue is because of ios 14. I used below combination of code for ios 14 and it worked like a charm

if #available(iOS 14.0, *) {
  pageControl.backgroundStyle = .minimal
  pageControl.allowsContinuousInteraction = false
}
like image 95
Varma Mukesh Avatar answered Jan 29 '23 12:01

Varma Mukesh