I have a view in an drawing application, it needs to respond in an other way when an other tool is selected. I thought it would be much nicer to replace t开发者_如何学Gohe NSResonder of that view in stead of setting every responder method of the view call the new responder method. Is this possible, of is there an other nice solution?
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.).
精彩评论