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

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

问题描述



在这个视图中,我有一个子类的NSScrollView,它本身就有一个NSImageView。 p>

当拖动到原始的NSView时,一切都很好,除了当我拖动上述NSImageView,这似乎是中断拖动,我不能掉到它上,它的下面的视图。



NSScrollView看起来忽略拖动,并允许它通过底层的NSView,但是如何才能为NSImageView这样做,以便拖放注册自己,它是superview(NSScrollView)和底层的NSView。

解决方案

您可以取消注册NSImageView作为拖动目的地,它的超级视图将处理拖动会话,如果设置为这样做。

  [imageView unregisterDraggedTypes] ; 


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

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

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.

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.

解决方案

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天全站免登陆