Re: Subclassing NSTextFieldCell - can't even get started!
Re: Subclassing NSTextFieldCell - can't even get started!
- Subject: Re: Subclassing NSTextFieldCell - can't even get started!
- From: Jerry Krinock <email@hidden>
- Date: Sun, 25 Nov 2007 20:53:08 -0800
On 2007 Nov, 25, at 19:52, David Preece wrote:
...I am attempting to do is change the behaviour of an
NSTextFieldCell by subclassing it. I've written a really simple
subclass, introduced it to IB2 and set the class of the appropriate
cell to be the name of the subclass
I never knew you could do that.
What I do, which works, is to override NSTableColumn, introduce that
into IB, set the class of my table column(s) to it, and then in the
implementation of my NSTableColumn subclass, override dataCellForRow:
to return a cell of my creation. Example:
@implementation MyTableColumn
- (id)dataCellForRow:(int)iRow {
NSString* identifier = [self identifier] ;
id item = [[self tableView] itemAtRow:iRow] ;
// Have a blast making different cells for
// different rows, columns, item types...
//
// simple case
NSTextFieldCell * cell =[[NSTextFieldCell alloc] init];
[cell setBordered:YES] ;
[cell setWhatever:whatever] ;
return [cell autorelease] ;
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden