Data can be placed in the pasteboard server in more than one representation. For example, an image might be provided both in Tag Image File Format (TIFF) and as encapsulated PostScript code (EPS). Multiple representations give pasting applications the option of choosing which data type to use. In general, an application taking data from the pasteboard should choose the richest representation it can handle—rich text over plain ASCII, for example. An application putting data in the pasteboard should promise to supply it in as many data types as possible, so that as many different applications as possible can use it.
Filtering services (see “Filter Services”) transform the data from one representation to another. Typically, these services are not invoked until data are read from a pasteboard.
Data types are identified by string objects containing the full type name. These global variables identify the string objects for the standard pasteboard types:
NSColorPboardType | NSColor data |
NSInkTextPboardType | Ink text data. For information on ink text objects, see Using Ink Services in Your Application. Available in Mac OS X v10.4 and later.. |
NSFileContentsPboardType | A representation of a file’s contents |
NSFilesPromisePboardType | Promised files |
NSCreateFileContentsPboardType | Returns a pasteboard type based on the passed file type. |
NSCreateFilenamePboardType | Returns a pasteboard type based on the passed file type. |
NSFilenamesPboardType | Array of NSString objects designating one or more filenames |
NSFindPanelSearchOptionsPboardType | Type for NSFindPanel metadata property list. Used with the NSPasteBoard method propertyListForType:. |
NSFontPboardType | Font and character information |
NSHTMLPboardType | HTML (which an NSTextView object can read from, but not write to) |
NSPDFPboardType | PDF data |
NSPICTPboardType | QuickDraw picture data |
NSPostScriptPboardType | Encapsulated PostScript (EPS) code |
NSRTFPboardType | Rich Text Format (RTF) |
NSRTFDPboardType | RTFD formatted file contents |
NSRulerPboardType | Paragraph formatting information |
NSSoundPboardType | NSSound data |
NSStringPboardType | NSString data |
NSTabularTextPboardType | An NSString object containing tab-separated fields of text |
NSTIFFPboardType | Tag Image File Format (TIFF) |
NSURLPboardType | NSURL data for one file or resource |
NSVCardPboardType | VCard data |
WebArchivePboardType | The pasteboard type constant used when adding or accessing a WebArchive on the pasteboard. |
Typically, data is written to the pasteboard using setData:forType:
and read using dataForType:
. Some of these types can only be written with certain methods. For instance, NSFilenamesPboardType
’s form is an array of NSString
objects and requires special handling. Use these methods to write these types:
Type |
Writing Method |
Reading Method |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NSFontPboardType |
Types other than those listed above can also be used. For example, your application may keep data in a private format that is richer than any of the existing types. That format can also be used as a pasteboard type.
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-07-13)