当 UIPopoverController 在屏幕上时,无法与包含结果的 UIPopoverController 的 UISearchBar 进行交互
我有一个 UISearchBar。当用户触摸 UISearchBar 时,会显示一个 UIPopoverController,其中包含结果的 UITableView。当用户键入时,结果就会出现。
我希望用户能够触摸 UISearchBar 中的灰色 x 按钮来清除搜索结果并清除 UISearchBar 的文本字段。然而,第一次触摸只是关闭 UIPopoverController,提示用户再次触摸按钮以清除文本字段。
有没有办法在显示 UIPopoverController 时允许与其他对象进行触摸交互?
I have a UISearchBar. When the user touches the UISearchBar, a UIPopoverController is shown that contains a UITableView of results. As the user types, the results appear.
I want the user to be able to touch the grey x button in the UISearchBar to clear the search results and clear the UISearchBar's text field. However, the first touch simply dismisses the UIPopoverController, prompting the user to touch the button a second time to clear out the text field.
Is there a way to allow touch interaction with other object while a UIPopoverController is showing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将 UIPopoverController 的
passthroughViews
属性设置为 UISearchBar。事实上,Apple 示例应用 ToolbarSearch 确实如此这:
Try setting the
passthroughViews
property of the UIPopoverController to the UISearchBar.In fact, the Apple sample app ToolbarSearch does exactly this: