On Wed, May 13, 2009 at 9:51 AM, I. Savant <idiotsavant2...@gmail.com> wrote: > On Wed, May 13, 2009 at 9:43 AM, Michael Ash <michael....@gmail.com> wrote: > >>> That would be difficult, hacky, and wrong. Why do you feel you need >>> to do this? What are you trying to accomplish? >> >> Actually it's trivial, correct, and documented. From the docs for >> frameOfCellAtColumn:row: >> >> You can use this method to update a single cell more efficiently than >> sending the table view a reloadData message. >> >> [aTableView setNeedsDisplayInRect:[aTableView >> frameOfCellAtColumn:column row:row]]; > > Well hell, Mike, I stand corrected! :-) > > I've used -frameOfCellAtColumn:row: before to animate a widget > flying out from a clicked cell, but never read the discussion portion. > I had assumed (obviously incorrectly) that -reloadData would be needed > prior to -setNeedsDisplayInRect: in order for the cell to reflect a > new / changed value.
Very understandable. I thought the same thing for quite a while. The fundamental fact that makes this all work is that NSTableView does not cache anything, at all, ever. It re-queries your data source every time it draws. This can lead to interesting drawing problems if you change your data source and forget to notify the table view, then scroll it a bit. It'll copy the existing pixels and then redraw the newly exposed area, which can lead to the top half of a line showing old data and the bottom half showing new data. This no-caching-ever behavior isn't what you'd expect, but once you know about it, the rest makes a lot more sense. Mike _______________________________________________ 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