• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Subclassing NSTextFieldCell - can't even get started!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Subclassing NSTextFieldCell - can't even get started! (From: David Preece <email@hidden>)

  • Prev by Date: Re: NSArrayController Frustration
  • Next by Date: Multiple applications, one NSUserDefaults object?
  • Previous by thread: Subclassing NSTextFieldCell - can't even get started!
  • Next by thread: Re: Subclassing NSTextFieldCell - can't even get started!
  • Index(es):
    • Date
    • Thread