Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pageIndicatorTintColor in UIPageControl stays translucent white in iOS7

Anyone has idea why setting color in pageIndicatorTintColor in UIPageControl does not work in iOS7? Here is the line of code where i set this property (self is UIPageControl):

[self setPageIndicatorTintColor:[UIColor greenColor]];

I checked in iOS Developer Library and description of this property seems to be same as was few weeks ago. Can it be deficiency of the Apple? Any idea how to fix it? However on iOS6 still works fine.

like image 540
Neru Avatar asked Dec 07 '22 05:12

Neru


1 Answers

Had the same problem, fixed this by changing an order of methods, first of all you need to set numberOfPages and only after that tintColor's:

before:

UIPageControl *pageControl = [[UIPageControl alloc] initWithFrame: ...
pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
pageControl.pageIndicatorTintColor = [UIColor grayColor];
pageControl.numberOfPages = 5;

now:

UIPageControl *pageControl = [[UIPageControl alloc] initWithFrame: ...
pageControl.numberOfPages = 5;
pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
pageControl.pageIndicatorTintColor = [UIColor grayColor];
like image 126
danylokos Avatar answered Mar 23 '23 01:03

danylokos