有人知道为什么在iOS7中无法在UIPageControl的pageIndicatorTintColor中设置颜色吗?这是我设置此属性(自身为UIPageControl)的代码行:
[self setPageIndicatorTintColor:[UIColor greenColor]];
我在iOS开发者库中签入,此属性的描述似乎与几周前相同。可能是苹果的不足吗?知道如何解决吗?但是在iOS6上仍然可以正常工作。
遇到相同的问题,可以通过更改方法的顺序来解决此问题,首先需要设置numberOfPages,然后再设置tintColor:
之前:
UIPageControl *pageControl = [[UIPageControl alloc] initWithFrame: ...
pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
pageControl.pageIndicatorTintColor = [UIColor grayColor];
pageControl.numberOfPages = 5;
现在:
UIPageControl *pageControl = [[UIPageControl alloc] initWithFrame: ...
pageControl.numberOfPages = 5;
pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
pageControl.pageIndicatorTintColor = [UIColor grayColor];
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句