• 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
Custom Cell not working in NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Custom Cell not working in NSTableView


  • Subject: Custom Cell not working in NSTableView
  • From: Todd Freese <email@hidden>
  • Date: Tue, 15 Aug 2006 20:36:04 -0500

I have a custom cell that displays an icon and text. It is a lift from the DragNDropOutlineView sample code. The data comes from a Core Data Entity and uses an NSArrayController and bindings to put the text into the custom cell. The problem is that all the rows contain the same icon, but the text is correct.

Since you can only bind one value, I have the following code to set the icon image.

- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
switch (rowIndex) {
case 0:
[aCell setImage:[NSImage imageNamed:@"icon1"]];
default:
[aCell setImage:[NSImage imageNamed:@"FolderRef"]];
}
}


I add the custom cell to the NSTableView this way:

- (void)awakeFromNib
{
NSTableColumn *columnRef = [[self tableColumns] objectAtIndex:0];
SourceListTextCell *theTextCell = [[[SourceListTextCell alloc] init] autorelease];
[theTextCell setEditable: YES];
[columnRef setDataCell:theTextCell];
}


I have used this custom cell class before with a manual dataSource and it worked, so I know the Custom Cell NSCopy methods are working OK.

Any ideas? I am really puzzled on this one...

Todd Freese
The Filmworkers Club
_______________________________________________
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


  • Prev by Date: Re: Interface Builder Help Broken?
  • Next by Date: Re: Interface Builder Help Broken?
  • Previous by thread: Re: Re: X-Code: multifile Global find/replace?
  • Next by thread: Re: Custom Cell not working in NSTableView
  • Index(es):
    • Date
    • Thread