• 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
Missing functionality in copy/paste of NSAttributedStrings? or of NSData?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Missing functionality in copy/paste of NSAttributedStrings? or of NSData?


  • Subject: Missing functionality in copy/paste of NSAttributedStrings? or of NSData?
  • From: James Stein <email@hidden>
  • Date: Sun, 21 Jun 2009 16:27:27 -0700

I use a few non-standard attributes in NSAttributedStrings.
("Standard" attributes are listed in the "Attributed Strings
Programming Guide.")

My first stumbling block is that such a string (or substring) in an
NSTextView, when copied and pasted, will "lose" its non-standard
attributes. (As an aside, the non-standard attributes will survive
encoding and decoding, and are preserved by the 'copy:withZone'
method.) It appears to me that the Cocoa methods for converting
attributed strings to-and-from NSData objects assume the used of
"standard" attributes; and it further appears to me that these
conversions neglect to copy non-standard attributes.

I use a subclass of NSTextView, and am willing to override the
copy/paste/cut methods that it inherits from NSText; and am willing
to employ an additional pasteboard type.  Here is my quandary:

It appears that the only objects that can be written to an NSPasteboard are
these:
NSData        (setData: forType)
NSString      (setString:forType:)
NSFileWrapper (writeFileWrapper:)
file content  (writeFileContents:)

OK, so it seems the first method is the only appropriate method, so
I need to create an NSData object from my NSAttributedString.
But how?

I must be missing something, but what?
_______________________________________________

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

  • Follow-Ups:
    • Re: Missing functionality in copy/paste of NSAttributedStrings? or of NSData?
      • From: Michael Ash <email@hidden>
    • Re: Missing functionality in copy/paste of NSAttributedStrings? or of NSData?
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Possible to set tab stops in an NSTextView?
  • Next by Date: Re: Possible to set tab stops in an NSTextView?
  • Previous by thread: Re: iPhone: Landscape support for tab bar?
  • Next by thread: Re: Missing functionality in copy/paste of NSAttributedStrings? or of NSData?
  • Index(es):
    • Date
    • Thread