• 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: About rich text fields
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >About rich text fields (From: Tristan Leblanc <email@hidden>)

  • Prev by Date: Re: Problems with double freeing.
  • Next by Date: applicationShouldTerminate: still not working
  • Previous by thread: About rich text fields
  • Next by thread: applicationShouldTerminate: still not working
  • Index(es):
    • Date
    • Thread