• 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: NSTableView custom cell problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSTableView custom cell problem
      • From: Andrew Skinner <email@hidden>
References: 
 >NSTableView custom cell problem (From: Andrew Skinner <email@hidden>)

  • Prev by Date: Re: Undo logic location?
  • Next by Date: #ifdef/build style question
  • Previous by thread: NSTableView custom cell problem
  • Next by thread: Re: NSTableView custom cell problem
  • Index(es):
    • Date
    • Thread