Re: NSTableView custom cell problem
Re: NSTableView custom cell problem
- Subject: Re: NSTableView custom cell problem
- From: j o a r <email@hidden>
- Date: Thu, 6 Jan 2005 19:24:35 +0100
On 2005-01-06, at 18.41, Andrew Skinner wrote:
However when I try and use the NSCell subclass in my tableview it
doesn't work, with a bit of hacking
What type of hacking?
i can get it to appear in the table view but only in the first cell
and each new item I add to my datasource the first cell gets
overwritten with another instance of the cell.
Expect the table view to sometimes create copies of your cell. Make
sure that your cell subclass can be copied.
//Set up image cell
cell = [NSImageCell new];
[theIconColumn setDataCell:cell];
//Set up text cell
nameCell = [[customCell alloc] init];
[theTextColumn setDataCell:nameCell];
This is a memory leak. The column will take ownership of the cells, and
you don't have any other references to them, so you need to release
them after handing them over to the columns. Something like this:
[myColumn setDataCell: [[[MyCellClass alloc] init] autorelease]];
[cell representedObject];
What do you expect this call to do?
j o a r
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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