• 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: Adding Links to Attributed String
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding Links to Attributed String


  • Subject: Re: Adding Links to Attributed String
  • From: Douglas Davidson <email@hidden>
  • Date: Thu, 13 Jun 2002 10:06:20 -0700

On Thursday, June 13, 2002, at 09:38 AM, Erik J. Barzeski wrote:

[someTextView replaceCharactersInRange:NSMakeRange(0, 0)
withRTFD:[someString RTFDFromRange: NSMakeRange(0, [someString length])
documentAttributes:nil]];

Don't do this. This is a weird kludgy attempt to try to avoid doing what you should be doing in the first place, which is working with the text storage. The text view's text storage is an NSTextStorage, which is a subclass of NSMutableAttributedString. Work with it and use all of your mutable attributed string methods on it. Take a look at the text system documentation on developer.apple.com; it explains the class relationships involved here.

The reason your particular example is failing is that conversion of attributed strings to RTFD is lossy, but there are plenty of other reasons not to do this.

Douglas Davidson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Adding Links to Attributed String (From: "Erik J. Barzeski" <email@hidden>)

  • Prev by Date: Re: How do you change the Application Icon in Interface Builder?
  • Next by Date: Re: Syntax Coloring...
  • Previous by thread: Adding Links to Attributed String
  • Next by thread: making a gif animate?
  • Index(es):
    • Date
    • Thread