• 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 11:23:31 -0500


On Oct 22, 2007, at 11:13 AM, I. Savant wrote:

Just looked but it uses two different nstextview and a subclass of
nsmutablestring used to wrap text from nstextview a to final
destination nstextview b (wrapped). It does not work with a single
nstextview.

So, applying the following to your existing text view doesn't help?

    NSTextView    *tv;
    NSArray      *lines;

    //  Get the individual lines as laid out by the text-view with
(soft or hard) newlines.
    lines = [tv lines];

    //  Return a single string with hard newlines in all the places
where the text-view broke it
    return [lines componentsJoinedByString: @"\n"];

More accurately, you'd need to first add the NSTextView(Lines) category to provide the [-lines] functionality (which is found in <http://developer.apple.com/samplecode/TipWrapper/listing7.html>, and does all the dirty work)


Also, the example does not use a subclass of NSMutableString, nor does it use two different NSTextView's - NSString(Wrapping) uses a single (reusable) NSTextView, and returns the wrapped text.

So the OP should take another look at those files, since they spell out quite explicitly how to accomplish their task...


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: "I. Savant" <email@hidden>
References: 
 >Text wrap in NSTextView-> how to get wrapped NSString (From: malcom <email@hidden>)
 >Re: Text wrap in NSTextView-> how to get wrapped NSString (From: glenn andreas <email@hidden>)
 >Re: Text wrap in NSTextView-> how to get wrapped NSString (From: malcom <email@hidden>)
 >Re: Text wrap in NSTextView-> how to get wrapped NSString (From: glenn andreas <email@hidden>)
 >Text wrap in NSTextView-> how to get wrapped NSString (From: malcom <email@hidden>)
 >Re: Text wrap in NSTextView-> how to get wrapped NSString (From: "I. Savant" <email@hidden>)

  • Prev by Date: Re: telling when a directory is really a bundle
  • Next by Date: Re: Text wrap in NSTextView-> how to get wrapped NSString
  • Previous by thread: Re: 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