防止NSView实例接收鼠标事件 [英] Prevent an instance of NSView from receiving mouse events
问题描述
我在一个打开核心动画层的窗口中有一个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屋!