How to add NSViewController to a responder chain?

后端 未结 4 1984
谎友^
谎友^ 2020-12-05 15:27

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

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-05 16:03

    There's a nice tutorial found at CocoaWithLove.com.

    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.

提交回复
热议问题