搜索页面的 UIPageControl 点
有没有什么方法可以在我的第一页上添加一个放大镜图标而不是点,以便使用 iPhone 上的本机应用程序的 UIPageControl 执行一些搜索?
我尝试用谷歌搜索,但根本没有找到类似的问题,但它看起来像是苹果应用程序中广泛使用的功能。
有人可以帮我提供建议吗?
Is there any way to add a magnification glass icon instead of the dot for my first page, that allows to perform some search, using the UIPageControl for my native application on the iPhone?
I've tried to google, but haven't find similar questions at all, but it looks like a wide-spread feature in Apple applications.
Can anybody help me with an advice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
基本上 UIPageControl 有一个
_indicators
数组,其中包含每个点的 UIView。该数组是私有财产,因此您不应该弄乱它。如果您需要自定义图标,则必须执行自己的页面指示器实现。编辑:经过更多研究,似乎您可以替换 UIPageControl 子视图来自定义点图像。检查 http://www.onidev.com/2009/12/02/customisable -uipagecontrol/ 了解详细信息。但仍不确定苹果评论者对这样做有何感想。
Basically UIPageControl has an
_indicators
array that contains UIViews for each of the dots. This array is a private property, so you should not mess with it. If you need custom icons, you will have to do your own page indicator implementation.Edit: After some more research, it seems you can replace the UIPageControl subviews to customize the dot images. Check http://www.onidev.com/2009/12/02/customisable-uipagecontrol/ for details. Still not sure how Apple reviewers are going to feel about doing such thing though.
我创建了一个 UIPageControl 子类来轻松合法地实现此目的(无需私有 API)。
基本上,我覆盖了 setNumberOfPages: 在最后一个圆圈内插入一个带有图标的 UIImageView 。然后在 setCurrentPage: 方法中,我检测最后一页是否突出显示,以修改 UIImageView 的状态,并清除圆圈的背景颜色,因为这将由 UIPageControl 私有 API 自动更新。
这是结果:
这是代码:
I created an UIPageControl subclass to achieve this easily and legally (without private APIs).
Basically, I overwritten setNumberOfPages: insert a UIImageView with he icon inside of the last circle. Then on the setCurrentPage: method I detect if the last page gets highlighted or not, to modify the UIImageView's state and also, clear the background color of the circle since this will be updated automatically by UIPageControl private APIs.
This is the result:
This is the code: