Re: [newbie] Font attributes in NSTextView
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.