• 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: Text wrap in NSTextView-> how to get wrapped NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Text wrap in NSTextView-> how to get wrapped NSString


  • Subject: Re: Text wrap in NSTextView-> how to get wrapped NSString
  • From: glenn andreas <email@hidden>
  • Date: Mon, 22 Oct 2007 10:44:49 -0500


On Oct 22, 2007, at 10:13 AM, malcom wrote:

Hello,
I would to simulate wrapped nstextview. I found I can resize used text
area and set my preferred wrapstyle but when I get out the relative
NSString it still remain unwrapped (correct it's right). Now I would
to get, for each line in NSTextView what character is the last of the
line, this screenshot should be clear
<http://img526.imageshack.us/img526/440/wrappingrq2.png>
so I'll add and \n to effective have the wrapped nsstring.
Anyone can help me?

There are a whole bunch of methods that NSLayoutManager provides for this sort of thing, but it is important to realize that your approach is going to have problems:


1) If the text is fully justified, you will loose that (since the last line of a paragraph is not fully justified, and by adding a return character you'll make all of the lines the last line)
2) If there is any extra paragraph space (see NSParagraph's paragraphSpacing and paragraphSpacingBefore), this will cause all the text to have different line spacing (since again, everything becomes a paragraph and the space between lines of a paragraph would be different than the spaces between paragraphs)
3) Any sort of indenting for the first line (NSParagraph's firstLineHeadIndent) will cause all of your lines to become indented.


More importantly, why are you trying to "simulate wrapped NSTextView"? Why can't you use a real wrapped NSTextView?

Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium2 | build, mutate, evolve, animate | images, textures, fractals, art



_______________________________________________

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


  • Follow-Ups:
    • Re: Text wrap in NSTextView-> how to get wrapped NSString
      • From: malcom <email@hidden>
References: 
 >Text wrap in NSTextView-> how to get wrapped NSString (From: malcom <email@hidden>)

  • Prev by Date: Re: Cannot Connect to NSDrawer
  • Next by Date: Re: Text wrap in NSTextView-> how to get wrapped NSString
  • Previous by thread: Text wrap in NSTextView-> how to get wrapped NSString
  • Next by thread: Re: Text wrap in NSTextView-> how to get wrapped NSString
  • Index(es):
    • Date
    • Thread