辅助屏幕的 makeKeyAndVisible 阻止 UIMenuController 出现
我在视图上呈现一个 UIMenuController 以显示复制和粘贴菜单弹出窗口。这很好用,但最近我向我的应用程序添加了外部屏幕功能。当我呈现一个视图并将其添加到外部屏幕时,我调用
...
[extWindow setScreen:extScreen];
[extWindow addSubview:viewController.view];
[extWindow makeKeyAndVisible];
...
但是 [extWindow makeKeyAndVisible];
似乎具有阻止我的菜单出现在视图中的副作用仍然在 iPad 上。
我该如何补救?
I present a UIMenuController over a view to display a copy and paste menu popup. This works great, but recently I added external screen functionality to my app. When I present a view and add it to the external screen I call
...
[extWindow setScreen:extScreen];
[extWindow addSubview:viewController.view];
[extWindow makeKeyAndVisible];
...
but the [extWindow makeKeyAndVisible];
appears to have the side effect of stopping my menu appearing in the view that is still on the iPad.
How can I remedy this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
UIMenuController 确实显示到当前的关键窗口 - 我不会将其设置回主窗口。这个故事的寓意是确保您希望菜单出现在其中的窗口是关键。
UIMenuController does indeed display to the current key window - I'd not set it back to the main window. Moral of the story is to make sure the window you want the menu to appear in is key.