Re: RTF pasting as plain text in NSTextView in some cases
Re: RTF pasting as plain text in NSTextView in some cases
- Subject: Re: RTF pasting as plain text in NSTextView in some cases
- From: "Kyle Sluder" <email@hidden>
- Date: Thu, 28 Feb 2008 14:45:54 -0500
On Thu, Feb 28, 2008 at 11:32 AM, Vince <email@hidden> wrote:
> Hi,
>
> My NSTextView has strange behavior when pasting: The rich text is
> pasted as plain text when the material has been copied from Safari.
> When the same material has been copied from another NSTextView (e.g.,
> TextEdit), it pastes properly as RTF.
What are the options set on your NSTextView in IB? It needs to be
rich-text editable.
> I checked my pasteboard type at the end of the
> windowControllerDidLoadNib routine:
>
> NSArray *arrDrag = [tView acceptableDragTypes];
> for(i=0;i<[arrDrag count];i++)
> NSLog(@"%@", [arrDrag objectAtIndex:i]);
Dunno if this was a quick & dirty debug attempt or whatnot, but there
are two style issues I'd like to highlight just as a note:
1) NSArray overrides -description to provide a reasonable string
representation of its contents, so if you call NSLog(@"%@", arrDrag)
things will Just Work(TM).
2) If you need something a bit fancier, instead of using the standard
for-loop array idiom, it's recommended that you use an enumerator. If
you're targeting 10.4, use NSEnumerator. If you're targeting 10.5,
you can instead use the new for(foo in bar) syntax to take advantage
of fast enumeration.
HTH,
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden