I am creating a button and should I subclass NSView and or NSButton?
1. I'm on a mac. 2. I want to do my own custom drawing
nanochrome
2009-12-18 04:33:23
NSButton != UIButton
0xced
2009-12-18 13:41:33
I'm aware of that, I've been balls deep in iPhone coding so I had thought he mis-spoke.
Sneakyness
2009-12-18 16:48:33
+6
A:
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.
Steve Streza
2009-12-18 04:38:34
+1
A:
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.
TechZen
2009-12-18 04:40:22