• 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] Font attributes in NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [newbie] Font attributes in NSTextView


  • Subject: Re: [newbie] Font attributes in NSTextView
  • From: Scott Anguish <email@hidden>
  • Date: Tue, 10 Sep 2002 01:26:26 -0400

On Tuesday, September 10, 2002, at 12:31 AM, Matt Neuburg wrote:

I have an NSTextView that'M addming lines to. I want some of these
lines to be bold (and perhaps in italics) and others to be plain text.
I've found out how to use NSAttributedString, but I cannot add an
attributed string to a text view.

How would I do this?


Matt's method is one option..

Another is to directly append onto the text storage..

Make a new Attributed String with the font characteristics you need

NSDictionary *attributesDict=[NSDictionary dictionaryWithObject:[NSFont boldSystemFontOfSize:12.0] forKey:NSFontAttributeName];
NSAttributedString *myNewLine=[[[NSAttributedString alloc] initWithString:@"my new line\n" attributes: attributesDict];
[[textView textStorage] appendAttributedString: myNewLine];


(typed into Mail... but you'll get the idea...)
_______________________________________________
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: 
 >Re: [newbie] Font attributes in NSTextView (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: (newbie)RE: Book- Building cocoa applications..
  • Next by Date: Re:Notifications of undoManager
  • Previous by thread: Re: [newbie] Font attributes in NSTextView
  • Next by thread: (newbie)RE: Book- Building cocoa applications..
  • Index(es):
    • Date
    • Thread