是否有某种委托方法在显示 NSView 时发送消息?当 NSView 显示在屏幕上时,我需要运行一个 NSTimer,如果它不是,我需要使其无效,这样它就不会一直在后台不必要地运行。
问问题
277 次
1 回答
0
Depending on how you've implemented your code, you could subclass NSView and create your own delegate protocol that sends out proper messages for various NSView events like setHidden
or "removeFromSuperview
".
If you're embedding this view into a single NSWindow object, you could subclass NSWindow and then throw your custom delegate protocol methods for "close
" or "performClose:
". Of course, in this case, there's actually already a "NSWindowDelegate
" protocol defined for you.
于 2012-07-02T22:07:42.243 回答