• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Displaying NSAttributedStrings in an NSTableView with non-uniform row height
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Displaying NSAttributedStrings in an NSTableView with non-uniform row height (From: "Christian Moen" <email@hidden>)

  • Prev by Date: Re: NSTExtView
  • Next by Date: Re: Newbie query re default buttons
  • Previous by thread: Displaying NSAttributedStrings in an NSTableView with non-uniform row height
  • Next by thread: PMSessionEndDocumentNoDialog error code -43
  • Index(es):
    • Date
    • Thread