Re: Displaying NSAttributedStrings in an NSTableView with non-uniform row height
Re: Displaying NSAttributedStrings in an NSTableView with non-uniform row height
- Subject: Re: Displaying NSAttributedStrings in an NSTableView with non-uniform row height
- From: Jens Alfke <email@hidden>
- Date: Thu, 22 May 2008 08:06:47 -0700
On 22 May '08, at 5:53 AM, Christian Moen wrote:
In order to get the row height correctly, I understand I need to
implement tableView:heightOfRow:. How can I find out how high my row
needs to be? I know I can call size on an NSAttributedString, but the
height returned doesn't take line breakage introduced by the
NSTableColumn into account.
Try using
- (NSRect)boundingRectWithSize:(NSSize)size options:
(NSStringDrawingOptions)options;
which lets you specify a width.
Make sure you cache the results of this, as it's a pretty expensive
call. For example, keep an array that caches the height of every row,
and invalidate the array if a column changes width, or an individual
item if the row's text changes.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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