I have a view in an drawing application, it needs to respond in an other way when an other tool is selected. 我认为替换该视图的 NSResonder 会好得多,而不是设置视图的每个响应者方法调用新的响应者方法。这可能吗,还有其他不错的解决方案吗?
问问题
298 次
1 回答
4
Each NSView
object does not "have" an NSResponder
. NSResponder
is the *superclass from which NSView
inherits, so no, it can not be changed. The easiest solution would be just to keep an ivar that tracks which tool is currently selected, then use that ivar to determine what action to take in the NSResponder
methods (-mouseDown:
, etc.).
于 2011-02-11T14:55:07.807 回答