如何将 NSViewController 添加到响应者链? [英] How to add NSViewController to a responder chain?

查看:24
本文介绍了如何将 NSViewController 添加到响应者链?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难理解和查找有关如何使 NSViewController 接受键和鼠标事件的信息.我在某处读到,为了在 NSViewController 中注册这些事件,应该将其添加到响应者链中,但我找不到如何正确执行此操作的答案.

I'm having hard time understanding and finding info about how to make NSViewController accept key and mouse events. I read somewhere that in order to register these events in NSViewController it should be added to a responder chain, but I can't find the answer how to properly do this.

非常感谢任何形式的帮助!

Any kind of help is highly appreciated!

推荐答案

有一个不错的 在 CocoaWithLove.com 上找到的教程.

总结:您将创建 NSView 的子类(例如EugeneView"),然后该子类中将包含一些额外的方法,例如setNextResponder"和setViewController".并且执行这两个方法应该可以将您的 NSViewController 集成到响应者链中.

Summed up: you'll create a subclass of NSView (e.g. "EugeneView") and then that subclass will have some extra methods in it, such as "setNextResponder" and "setViewController". And doing these two methods should get your NSViewController integrated into the responder chain.

这篇关于如何将 NSViewController 添加到响应者链?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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