NSView Subviews 中断拖拽操作 [英] NSView Subviews interrupting drag operation

查看:21
本文介绍了NSView Subviews 中断拖拽操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个为拖动操作注册的 NSView.

I have an NSView which is registered for a drag operation.

在那个视图中,我有一个子类 NSScrollView,它本身就有一个 NSImageView.

In that view I have a subclassed NSScrollView, which in itself has an NSImageView in it.

当拖到原始 NSView 上时,一切都很好,除了当我拖到前面提到的 NSImageView 上时,这似乎中断了拖拽,我不能放到它上面(或者实际上是它下面的视图.

When dragging onto the original NSView, everything is fine, other than when I drag over the aforementioned NSImageView, which seems to interupt the drag and I cannot drop onto it (or in fact, the view underneath it.

NSScrollView 似乎忽略了拖动并允许它通过底层 NSView,但是我怎样才能为 NSImageView 做到这一点,以便 Drag/Drop 通过自身注册,它是超级视图(NSScrollView)并进入底层NSView.

The NSScrollView appears to ignore the drag and allows that to go through to the underlying NSView, but how can I do that for the NSImageView so that the Drag/Drop registers through itself, it's superview (the NSScrollView) and onto the underlying NSView.

推荐答案

您可以将 NSImageView 取消注册为拖动目标.然后,它的 superview 将处理拖动会话,如果它设置为这样做的话.

You can unregister the NSImageView as a dragging destination. Its superview will then handle the dragging session, if it's set up to do that.

[imageView unregisterDraggedTypes];

这篇关于NSView Subviews 中断拖拽操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆