• 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
line spacing differences between NSTextView and NSAttributedString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

line spacing differences between NSTextView and NSAttributedString


  • Subject: line spacing differences between NSTextView and NSAttributedString
  • From: Chris Eplett <email@hidden>
  • Date: Tue, 28 Feb 2006 16:06:44 -0500

Hi all,

I've got an NSAttributedString that I'm drawing using the drawInRect method in my view. Now, the user can edit this string by double clicking it. When they do so, I stop drawing the text, then position and show an NSTextView that has been populated with the NSAttributedString using [[view textStorage] setAttributedString:str]. When they click elsewhere, the contents of the NSTextView are transferred back to my NSAttributedString, and I hide the NSTextView and start drawing the string again.

Functionally, this all works like a charm. There is a problem, however, in that the line spacing is not the same when the text view draws it versus when I draw it w/ drawInRect.

The drawInRect method spaces the lines slightly further apart than NSTextView does, so the user sees an accordion effect as the text becomes editable.

I've tried explicitly setting the line spacing to 0 using NSParagraphStyle, to no avail.

Any thoughts on how I can get NSTextView and NSAttributedString's drawInRect methods to render the text with the same metrics?

Thanks in advance!
Chris Eplett

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: line spacing differences between NSTextView and NSAttributedString
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: Trouble with passing variables
  • Next by Date: Re: line spacing differences between NSTextView and NSAttributedString
  • Previous by thread: Re: Trouble with passing variables
  • Next by thread: Re: line spacing differences between NSTextView and NSAttributedString
  • Index(es):
    • Date
    • Thread