• 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: how to insert a NSAttributedString into a NSTextview ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >how to insert a NSAttributedString into a NSTextview ? (From: Jérémie Banier <email@hidden>)

  • Prev by Date: Using Java objects in ObjC
  • Next by Date: Re: Allocating memory in Cocoa
  • Previous by thread: how to insert a NSAttributedString into a NSTextview ?
  • Next by thread: Re: how to insert a NSAttributedString into a NSTextview ?
  • Index(es):
    • Date
    • Thread