Re: Subclassing NSButton
Re: Subclassing NSButton
- Subject: Re: Subclassing NSButton
- From: Ricky Sharp <email@hidden>
- Date: Fri, 4 Nov 2005 17:39:03 -0600
On Nov 4, 2005, at 5:01 PM, Ryan Stevens wrote:
How it's instantiated shouldn't matter, should it? Assuming it's
really a subclass of NSButton (and not NSObject or something)
initWithCoder should be there.
I'd be most interested in the header.
Depending upon how it's created, different APIs will be called. When
programatically creating a view, you typically call initWithFrame:
(or a designated initializer that in turn calls intiWithFrame:)
When your view is stored in a nib, it is re-created via initWithCoder.
Something else that may be going on is due to what cell is being
created. When subclassing controls, you typically subclass both the
control class and the corresponding cell class. A subclass of
NSButton that doesn't implement +cellClass (or any of the other APIs
to set the cell class) will use instances of NSButtonCell as its cell.
As a side note, I had a terrible time subclassing NSButton/
NSButtonCell. Instead, I subclassed NSControl/NSActionCell.
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden