質問

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?

役に立ちましたか?

解決

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top