Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Proper custom NSCell creation in NSTableView

I've created bunch of NSTableViews I'm trying to create one that display a single column custom NSTextCell in each row. At the moment everything is working fine and cells are drawing correctly but if I use it long enough it'll crash. It crashes when willDisplay is called and I'm setting the dat into the cell. After digging into it I think that I'm not creating and/or retaining the custom NSTextCell correctly.


Is there a good clean example of when the cell should be created? Should I be creating a cell for each row? The problem is that the display routines gets called over and over and I'm afraid that I'll over create the cells, but right now I think I'm under creating cells so that when a row is deleted it's freeing the cell from under another display cell.


Any thoughts and examples appreciated,

=Tod

Posted on Sep 4, 2012 8:00 PM

Reply
Question marked as Best reply

Posted on Sep 9, 2012 7:54 AM

Just to post in response to my own question - the issue was actually not with the cell creation but the lifetime of the information that I was setting as my data. NSCopy only copies pointers and does not do a deep copy and some of my data was apparently getting altered out from under my display. A re-reading of copyWithZone docs was helpful.

1 reply
Question marked as Best reply

Sep 9, 2012 7:54 AM in response to Tod Kuykendall

Just to post in response to my own question - the issue was actually not with the cell creation but the lifetime of the information that I was setting as my data. NSCopy only copies pointers and does not do a deep copy and some of my data was apparently getting altered out from under my display. A re-reading of copyWithZone docs was helpful.

Proper custom NSCell creation in NSTableView

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.