Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem in creating UIPageControl Programmatically?

// Init Page Control

UIPageControl *pageControl = [[UIPageControl alloc] init]; 
pageControl.frame = CGRectMake(110,5,100,100); 
pageControl.numberOfPages = 2; 
pageControl.currentPage = 0; 
[self.view addSubview:pageControl];

I'm trying to create UIPageControl programmatically. I created new view based app. In which, i have written this code in ViewControllers viewDidLoad, but its not creating page control. When i see in console viewdidload is called many times.

like image 387
sumit Avatar asked Apr 24 '26 19:04

sumit


1 Answers

LMAO with this one cause I just had the same problem :) if you still got this problem or any one else will struggle with this try setting background colour simply like

pageControl.backgroundColor = [UIColor redColor];

the funny thing is that page controls' default colour settings make it difficult to notice on i.e. clear white view :)

like image 154
Michał Kreft Avatar answered Apr 27 '26 21:04

Michał Kreft



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!