• 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: Newbie:Attributed Text Strings and NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie:Attributed Text Strings and NSTextView


  • Subject: Re: Newbie:Attributed Text Strings and NSTextView
  • From: Tony Cate <email@hidden>
  • Date: Sat, 25 Sep 2004 06:50:31 -0500

Both varients of addAttribute requite a range:

- (void)addAttributes:(NSDictionary *)attributes range:(NSRange)aRange
- (void)addAttribute:(NSString *)name value:(id)value range:(NSRange)aRange

I find AppKiDo invaluable for this kind of thing.

I assume testList is a textView. Try: [[textList textStorage] setAttributedString:stringTest].

Tony
3 Cats And A Mac
http://www.3caam.com


>I have a program with two NSTextViews.  The first NSTextView holds a
>simple NSString.  This one works great.  The second NSTextView holds an
>attributed string (or at least it should) that changes the display
>font.  Two problems have happened.  I initialize the NSAttributedString
>with the NSString used to fill the first NSTextView.  Then I use the
>NSFont class to create a font object I attempt to use a font with the
>name Arial.  Obviously I have constructed this call wrong since it
>fails to compile.  Next when I attempt to use the addAttribute  I am
>told that stringTest will not respond to the addAttribute method.  Last
>I have failed to find the method to set the contents of the testList
>NSTextView to the testString.   Source code shown below.
>
>Thanks
>       newFont = [fontWithName:@"Arial" size:24];
>       stringTest = [[NSMutableAttributedString alloc]
>initWithString:stringNumber];
>       [stringTest addAttribute:NSFontAttributeName
>                          value:[newFont userFontSize:24]];
>       [testList setString:stringTest];
>-----
> _______________________________________________
>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
 _______________________________________________
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: 
 >Newbie:Attributed Text Strings and NSTextView (From: Clayton Leitch <email@hidden>)

  • Prev by Date: Re: How to do a progress window the "right way"?
  • Next by Date: Re: Multiple Inheritence (Was: Is _objc_flush_caches_(Class) necessary to swizzle methods?)
  • Previous by thread: Newbie:Attributed Text Strings and NSTextView
  • Next by thread: Re: Newbie:Attributed Text Strings and NSTextView
  • Index(es):
    • Date
    • Thread