拖放drop:检测你正在掉落的东西

发布于 2024-09-29 12:08:39 字数 447 浏览 0 评论 0原文

Cocoa-Touch 的长辈们,我有一个关于 Drag & 的问题要问你们。放在 iPad 上。

我正在尝试将一个项目从弹出窗口拖到底层画布上。使用 UIPanGestureRecognizer 类,我可以检测拖动开始并创建一个 UIView 以用指尖拖动。我的应用程序以横向模式运行。

当在下面的 UIViews 树上拖动时,麻烦就来了:我怎样才能找到我当前正在拖动的内容?当给定 [UIApplication sharedApplication].keyWindow 时,[UIView hitTest:withEvent:] 始终 返回一个 UIDimmingView (我没有放在那里)。如果我将创建的 UIView 传递给 hitTest 调用,那么我无法检测到返回到原始弹出窗口的情况 - 因此无法检测到“毕竟不要拖动”手势。

非常欢迎您的线索和嘘声。

M。

Assembled elders of the Cocoa-Touch, I have a question for you all about Drag & Drop on the iPad.

I am attempting to drag an item from a popover onto an underlying canvas. Employing the UIPanGestureRecognizer class I can detect a drag-start and create a UIView to drag with the finger tip. My application runs in landscape mode.

The trouble comes when dragging across the tree of UIViews underneath: how can I find out what I am dragging across currently? When given [UIApplication sharedApplication].keyWindow, [UIView hitTest:withEvent:] always returns a UIDimmingView (that I didn't put there). If I pass a UIView that I've created to the hitTest call then I cannot detect a drop back onto the original popover - and therefore cannot detect a "don't drag after all" gesture.

Your clues and boos are most welcome.

M.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文