Replace the NSResponder of an existing NSView

331 views Asked by At

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 the 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?

1

There are 1 answers

1
indragie On BEST ANSWER

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.).