Re: how to insert a NSAttributedString into a NSTextview ?
Re: how to insert a NSAttributedString into a NSTextview ?
- Subject: Re: how to insert a NSAttributedString into a NSTextview ?
- From: James Spencer <email@hidden>
- Date: Sun, 26 Dec 2004 09:35:47 -0600
On Dec 25, 2004, at 2:22 PM, Jérémie Banier wrote:
Hello,
I'm pretty new to cocoa and I would like to know how you can insert an Attributed string into a NSTextView ...
I was expecting the following to do some things but I does not do much ...
NSMutableString* s = [ NSMutableString stringWithFormat: @"0xlx:", fh?foff:(unsigned long)p ];
foff += sizeof(ppc_word);
tempString = [tempString initWithString: s ];
[ tempString addAttribute: NSForegroundColorAttributeName
value: [NSColor blueColor]
range: NSMakeRange(0, [ s length ])];
[ myRTFTxt replaceCharactersInRange: NSMakeRange(0, [ [ myRTFTxt string ] length ])
withString: tempString ];
I would appreciate any comments, pointer, samples ...
What are tempString and myRTFTxt? If you are going to add attributes to it then it presumably is an NSMutableAttributedString. But replaceCharactersInRange:withString: takes an NSString as the second parameter, not an attributed string. Assuming that myRTFTxt is the textStorage for the text view, you should be able to do the same as the above with replaceCharactersInRange:withAttributedString.
Spence
James P. Spencer
Rochester, MN
email@hidden
"Badges?? We don't need no stinkin badges!"
_______________________________________________
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