Re: Adding Links to Attributed String
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.