OGeek|极客世界-中国程序员成长平台

标题: ios - 如何更改页面 Controller 点图像? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 16:39
标题: ios - 如何更改页面 Controller 点图像?

我在 ScrollView 中添加了页面 Controller 。页面 Controller 与我的 ScrollView 一起工作正常。但我需要在页面 Controller 的指示器上实现不同的图像(即出现在页面 Controller 中的点)。那是选择的指标的不同图像,以及页面 Controller 的未选择指标的不同图像。请帮忙。我在互联网上搜索了很多。试图找到第三方文件,但它们与指示器的形状或颜色有关。请帮忙。

请在答案中添加此页面的链接,因为在我的情况下它不起作用: Is there a way to change page indicator dots color



Best Answer-推荐答案


是的,您可以在页面控件中设置点的图像。以下代码适用于 ios 6 及更高版本。

    self.pageControl.pageIndicatorTintColor = [UIColor colorWithPatternImage:[UIImage imageNamed"dot_inactive.png"]];

    self.pageControl.currentPageIndicatorTintColor = [UIColor colorWithPatternImage:[UIImage imageNamed"dot_active.png"]];

关于ios - 如何更改页面 Controller 点图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20122166/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4