防止NSView实例接收鼠标事件 [英] Prevent an instance of NSView from receiving mouse events

查看:82
本文介绍了防止NSView实例接收鼠标事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个打开核心动画层的窗口中有一个NSView.我使用此视图不时显示带有动画的图像.我不仅需要图像,还需要将整个视图作为底层.在此视图(我称为AnimationBaseView)的后面是用户与之交互的其他视图.

I have an NSView in a window with core animation layer turned on. I use this view to display images with animation from time to time. I need the entire view to be the back layer not only the images. Behind this view which I call AnimationBaseView are other views which the user interacts to.

一切正常,除了AnimationBaseView阻止其他视图获取rightMouseDown事件.

Everything is ok except the AnimationBaseView prevents the other views from getting rightMouseDown events.

我尝试了以下操作:

  • 将"NO"返回到AnimationBaseView的接受FirstResponder"
  • 根据需要隐藏和取消隐藏AnimationBaseView,但是会产生讨厌的闪烁.

感谢您的帮助,何塞.

推荐答案

覆盖-(NSView *)hitTest:(NSPoint)aPoint 返回 nil 或视图应该可以处理鼠标事件的

Override - (NSView *)hitTest:(NSPoint)aPoint to return either nil or the view that should handle the mouse events

这篇关于防止NSView实例接收鼠标事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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