Re: About rich text fields
Re: About rich text fields
- Subject: Re: About rich text fields
- From: Ryan Stevens <email@hidden>
- Date: Sun, 20 Nov 2005 08:28:30 -0800
This is a FAQ...
-insertText: takes an NSString. You want to append attributed strings
so you need to add them straight to the textStorage...
[[textView textStorage] appendAttributedString:rtfString];
On Nov 20, 2005, at 7:46 AM, Tristan Leblanc wrote:
Hello,
I try to display rich text in an NSTextField (programmatically
created).
I do something like this, but it does'nt work.
NSAttributedString *rtfString = [[NSAttributedString alloc]
initWithRTF:rtfData documentAttributes:nil];
NSTextView *textView = [[NSTextView alloc]
initWithFrame:cFrame];
[textView setRichText:YES];
[textView setDrawsBackground:NO];
[textView insertText:rtfString];
Finally, the field is drawing itself, but there is no glyphs visible.
When I select all my field content (no selection visible as well)
and cut, then paste in TextEdit, I can see the text content of the
field, without any particular style.
Something is missing, but what???
Tristan
_______________________________________________
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