I am creating a button and should I subclass NSView and or NSButton?
1
votes
3 Answers
7
votes
If you only want to do custom drawing, consider subclassing NSButtonCell
, which is the class responsible for drawing within a button. If that's not powerful enough to do what you want, you should subclass NSButton, as it'll give you lots of behavior for free, and will let you set up the button in Interface Builder as you would any other control.
1
votes
You very seldom have to subclass to get the button appearance you want. You can load a button up with images for various states and you can make it into any rectangular shape or size.
If you want can't get what you want from NSButton, then look look at subclassing NSControl instead of NSView. That way, you get the interaction methods.