将 UISegmentedControl 添加到 UISearchBar 而不是范围按钮
我想在 UISearchBar 下方添加范围按钮。但是我无法更改内置示波器按钮的色调颜色。
相反,我将 UISegmentedControl 添加到我的 tableViewHeader 中。这工作得很好,但只有当我没有在 UISearchbar 中输入内容时才会显示。不是很方便。
当我在 UISearchBar 中输入文本时,表格和分段控件会被“未显示结果”半透明黑色层隐藏。一旦结果开始显示我的分段控制就会完全消失,只有带有结果的细胞才会显示。
我想让分段控件在搜索栏中输入文本时可单击。
您知道有什么方法可以执行以下操作吗?
- 输入文本时使 UISegmentedControl 与 UISearchBar 一起移动,或者
- 在搜索结果显示在 UITableView 上时显示 UISegmentedControl
谢谢
I'd like to add scope buttons below my UISearchBar. However I cannot change the tint color of the built in scope buttons.
Instead, I added a UISegmentedControl to my tableViewHeader. This works well enough, but it only shows when I am not typing into the UISearchbar. Not very convenient.
When I enter text into the UISearchBar, the table and segmented controls become hidden by the "no results shown" semi-opaque black layer. Once results start showing my segmented control disappears altogether, and only cells with results show.
I want to make the segmented control clickable during text entry into the search bar.
Do you know of any way to do the following?
- make UISegmentedControl move with UISearchBar when text is being entered, or
- show UISegmentedControl whilst search results are displayed on the UITableView
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
@end
获取所需的分段控件,并从那里对其进行着色
(它目前位于索引 0,但这绝对不确定)
没有使用“私有 API”,所以苹果应该可以接受,
但请注意,如果他们更改了视图布局(不太可能),这可能会中断,
这会产生色调消失的副作用,你应该
通过标准搜索栏 API 访问其其余状态
try
@end
to get hold of the segmented control you want, and tint it from there
(it's currently at index 0, but that's definitely not for sure)
there is no "private API" being used, so apple should be okay with it,
but note if they changed their view layout (unlikely), this could break,
which would have the side effect of your tint disappearing, you should
access the rest of its state through the standard search bar APIs