Drawing glitches in NSTableView with variable row hight (just like Console.app)
Drawing glitches in NSTableView with variable row hight (just like Console.app)
- Subject: Drawing glitches in NSTableView with variable row hight (just like Console.app)
- From: Marco Masser <email@hidden>
- Date: Mon, 19 Apr 2010 17:56:40 +0200
Hi,
I'm trying to implement a logging facility for an app that should behave quite the same as OS X's Console.app in terms of displaying the log, i.e. an NSTableView with varying row heights. I got it working so far, but there are major drawing glitches when resizing the window or scrolling through the list.
As in Console.app, I have a string which determines the height of each table row. I found three different approaches to calculating the height for a given width, but they all seem to be very performance-hungry:
1) (my favorite) I set the message string on my message column's NSTextFieldCell directly and call -cellSizeForBounds:
2) Creating an NSAttributedString with the attributes of my cell, calculating its size and then using the string's total width and my column's width to calculate the number of rows (seems to be off some times).
3) Using some code from the docs involving an NSTextStorage, NSLayoutManager, and an NSTextContainer.
I found a few discussions on this and similar topics, but most of them only dealt with performance improvements using caching of row height. But my biggest concern are the drawing errors. If they only occurred while resizing the window, it probably would suffice to force a redraw, but the drawing glitches while scrolling are just bad.
Does anyone have some suggestions regarding these problems?
Thanks in advance,
Marco_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden