Re: NSTableView updating single cells
Re: NSTableView updating single cells
- Subject: Re: NSTableView updating single cells
- From: Ryan Stevens <email@hidden>
- Date: Thu, 6 May 2004 07:04:24 -0700
I don't know why I hadn't thought of this before - it seems obvious now.
Works on Jaguar and Panther.
Only one correction...
if (!NSEqualRects(updateRect, NSZeroRect)) [yourTableView
setNeedsDisplayInRect:updateRect];
On May 5, 2004, at 2:59 PM, Louis C. Sacha wrote:
Hello...
I don't know if this will work (I can't test this at the moment), but
you could try "dirtying" just the rows or cells that need to be
updated...
For example, if you wanted to update a particular row:
NSRect updateRect = [yourTableView rectOfRow:rowToUpdate];
if (updateRect != NSZeroRect) {[yourTableView
setNeedsDisplayInRect:updateRect];}
Or for a particular cell,
NSRect updateRect = [yourTableView frameOfCellAtColumn:columnofCell
row:rowOfCell];
if (updateRect != NSZeroRect) {[yourTableView
setNeedsDisplayInRect:updateRect];}
That way, hopefully the NSTableView would redraw only the needed
rects, and only reload the data for those specific cells. It is also
possible that the "dirty" rects will be combined into one large rect,
which would mean a more cells being redrawn, but in most cases it
would still help, especially if all of the updated cells are close to
each other. Of course, it's also possible that it won't cause the
cells to be updated at all, or it might end up triggering a full
reload anyway, since this is just a theory based on the documentation.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.