使用 modalInPopover 显示弹出窗口时如何禁用主工具栏?
我正在显示一个弹出窗口,其中包含的视图控制器设置了 modalInView 属性。我需要用户在继续之前在此处输入响应。
虽然这会禁用我的大部分用户界面控件,但它确实会禁用主应用程序上的工具栏按钮。我不希望用户在选择弹出窗口中的项目并关闭它之前与应用程序进行交互。
我在这里错过了一些聪明的东西吗 - 即默认情况下会禁用工具栏?为什么它仍然活跃?是否有一些需要它的用户界面指南?
我应该将工具栏设置为禁止用户交互,还是很混乱?
I'm displaying a popover with the contained view controller having the modalInView property set. I need the user to enter a response here before continuing.
While this disables most of my user interface controls, it does disable the toolbar buttons on the main app. I don't want the user to interact with the application before selecting an item in the popover and closing it.
Am I missing something clever here - i.e. that would disable the toolbar by default? Why does it remain active? Is there some user interface guidelines that require it?
Should I just set the toolbar to disallow user interaction, or is that messy?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当您从 UIBarButtonItem 呈现该栏时,iOS 似乎将该栏添加为弹出窗口的“直通视图”。
只需在呈现 UIPopoverController 后将其设置为 nil passthroughViews 属性,如下所示:
It seems like iOS adds the bar as a "passthrough view" for the popover, when you present it from UIBarButtonItem.
Just set to nil passthroughViews property of UIPopoverController after presenting it, like this:
请改用
-[UIPopoverController PresentPopoverFromRect:inView:permissedArrowDirections:animated]
,默认情况下不启用工具栏交互。例如,如果从设置了 customView 属性的UIBarButtonItem
进行呈现:Use
-[UIPopoverController presentPopoverFromRect:inView:permittedArrowDirections:animated]
instead, which doesn't enable toolbar interaction by default. For example, if presenting from aUIBarButtonItem
with a customView property set:我发现最有效的是你在问题中提到的可能性:
What I found working best is what you mention as possibility in your question: