在UIPageControl的索引0处自定义带有UIPageControl图像的点 [英] Customize dot with image of UIPageControl at index 0 of UIPageControl
问题描述
我是ios编程的新学习者。我试图在stackoverflow上搜索另一个示例和更多问题,但这不是我的目标。我想在UIPageControl的索引0处设置一个点的图像,类似于iPhone搜索主屏幕。有办法吗?请用一些代码或其他有用的链接向我解释。
I'm a new learner of ios programming. I have tried to search with another example and more questions at stackoverflow but it's not my goal. I want to set an image of dot at index 0 of UIPageControl as similar as iPhone search homescreen. Have any way to do it ? Please explain me with some code or another useful link.
提前致谢
推荐答案
尝试此链接: -
使用GrayPageControl回答: -
有没有办法改变页面指示器点的颜色
Answer with GrayPageControl:- Is there a way to change page indicator dots color
这真的很好,可靠。我也使用过此代码。
It is really good and reliable.I also have used this code.
您可能需要进行更多自定义
You might have to do some more customization as
-(void) updateDots
{
for (int i = 0; i < [self.subviews count]; i++)
{
UIImageView* dot = [self.subviews objectAtIndex:i];
if (i == self.currentPage) {
if(i==0) {
dot.image = [UIImage imageNamed:@"activesearch.png"];
} else {
dot.image = activeImage;
}
} else {
if(i==0) {
dot.image = [UIImage imageNamed:@"inactivesearch.png"];
} else {
dot.image = inactiveImage;
}
}
}
}
这篇关于在UIPageControl的索引0处自定义带有UIPageControl图像的点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!