如何在 UIPopoverController 之上添加视图
我有一个 iPad 应用程序,其中有一个“抽屉”表显示在弹出窗口中。用户可以点击并按住抽屉中的某个项目,将该项目从抽屉中拖出并拖入我的主视图中。那部分工作正常;不幸的是,被拖动的视图出现在弹出窗口下方,并且太小而无法看到,直到从其下方拖出为止。如果我将视图添加为弹出窗口中的视图控制器的子视图,它会被弹出窗口的框架剪切,并且因为我无法访问 UIPopoverController
的视图,我无法禁用其图层的 masksToBounds
- 无论如何,这可能不是一个好主意。我怀疑我可以使用一个具有高 windowLevel
值的附加 UIWindow
来强制拖动的视图出现在弹出窗口的顶部,但这似乎有点矫枉过正。有更好的解决方案吗?
I've got an iPad app with a “drawer” table displayed in a popover. The user can tap-and-hold on an item in the drawer to drag that item out of it and into my main view. That part works fine; unfortunately, the view being dragged appears under the popover, and is too small to be visible until it's dragged out from underneath it. If I add the view as a subview of the view controller in the popover, it gets clipped by the popover's frame, and as I can't access the UIPopoverController
's view, I can't disable its layer's masksToBounds
—and that probably wouldn't be a great idea anyway. I suspect that I could use an additional UIWindow
with a high windowLevel
value to force the dragged view to appear on top of the popover, but this seems like overkill. Is there a better solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
知道了。
UIWindow
工作正常。代码:Got it.
UIWindow
works fine. Code:添加 Swift 版本:
编辑管理员:感谢您的审查 - 重复删除我的其他答案 如何在 UIPopoverController 上显示 UIView
Adding the Swift Version:
EDIT to admin: thanks for the review – deleted my other answer in duplicate How to show a UIView OVER a UIPopoverController