我可以在 UISearchDisplayController 中插入按钮吗?
当用户点击搜索栏,没有输入任何文本,并且屏幕变暗(但桌面视图尚未出现)时,我想在屏幕上放置一个按钮以允许用户导航离开到一些其他功能。这可能吗?
谢谢!
When a user has tapped in a search bar, hasn't entered any text, and the screen has been darkened (but the tableview has not appeared yet), I would like to put a button on the screen to allow the user to navigate away to some other functionality. Is that possible?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是相当棘手的。 _dimmingView 是 searchDisplayController 私有的,它位于所有子视图之上。您可以做的是每次出现时用自定义视图覆盖它([searchString length] == 0 和 DidBeginSearch)
(tempView 的框架设置为放置在表的 tableViewHeader 上的 UISearchBar)
注意:我尝试在 DidBeginSearch 上创建一个新实例并释放它在 DidEndSearch 上,并且仅适用于第一次调用!奇怪...
希望这有帮助
This is quite tricky. The _dimmingView is private to the searchDisplayController and it goes above all subviews. What you can do is cover it with your custom view every time it appears ([searchString length] == 0 and DidBeginSearch)
(tempView's frame is set for UISearchBar placed on table's tableViewHeader)
Notes: I tried creating a new instance on DidBeginSearch and releasing it on DidEndSearch, and it worked only for the 1st call! Weird...
Hope this helps