On Aug 21, 2010, at 23:24, Hrishikesh Murukkathampoondi wrote: >> The 'dataCellForTableColumn:...' delegate method is intended to return a >> data cell for the >table column to use>, but *not* to configure the cell >> value for the specific row it's going >to represent. Remember that the >> object val>ue comes from the data source object, not the del>egate object, >> and it's therefore wrong for the delegate objec>t to try to supply the value. > I don't understand your answer. > The documentation for -tableView:dataCellForTableColumn:row: says > "A different data cell can be returned for any particular table column and > row, or a cell that will be used for the entire row (a full width cell)." > What I am trying to do is to display multiple text items arranged in a custom > format. For that purpose I use this delegate method to return my "custom > cell" wherein I have modified drawWithFrame:inView: to do my custom drawing. > From the documentation I understand that this delegate method is used to > return an NSCell subclass. This subclass can include a custom method to draw > the cell.
The cell is OK -- there's nothing wrong with the cell. But it's wrong to use 'setObjectValue:' in 'tableView:dataCellForTableColumn:row:'. Here's the sequence of events: #1. The table view calls the delegate's 'tableView:dataCellForTableColumn:row:' to get the cell for the row and column. #2. The table view calls the data source's 'tableView:objectValueForTableColumn:row:' to get the object value for the row and column. #3. The table view sets that object value in the cell, using 'setObjectValue:'. #4. The table view causes the newly-configured cell to be drawn. So, setting the object value in #1 doesn't achieve anything useful. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com