Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIPageControl has clear background color but is still cutting out overlapping text view

I'm using a UIPageViewController where I have a button close to the page control indicator dots. In this first screenshot I've made the background color of the page control red to illustrate how the page control and button are overlapping:

enter image description here

However if I change the background to be a clear color then the text within the button is still being chopped off at the bottom by the page indicator.

I've additionally tried setting the page indicator's Opacity to NO but it makes no difference:

enter image description here

The control is being configured like this:

UIPageControl *pageControl = [UIPageControl appearance];
pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
pageControl.currentPageIndicatorTintColor = [UIColor blueColor];
pageControl.backgroundColor = [UIColor clearColor];
[pageControl setOpaque:NO];
like image 250
Gruntcakes Avatar asked Nov 27 '25 12:11

Gruntcakes


1 Answers

You can use this code

UIPageControl *pageControl = [[UIPageControl alloc] init];;
pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
pageControl.currentPageIndicatorTintColor = [UIColor blueColor];
pageControl.backgroundColor = [UIColor clearColor];
[pageControl setOpaque:NO];
pageControl.frame = CGRectMake(110,5,100,100);
pageControl.numberOfPages=3;
pageControl.currentPage=2;
[self.view addSubview:pageControl];

Screenshot

like image 153
souvickcse Avatar answered Nov 30 '25 02:11

souvickcse



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!