Retired Document
Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
Data Types
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 | |
NSInkTextPboardType | |
NSFileContentsPboardType | |
NSFilesPromisePboardType | |
NSCreateFileContentsPboardType | |
NSCreateFilenamePboardType | |
NSFilenamesPboardType | |
NSFindPanelSearchOptionsPboardType | |
NSFontPboardType | |
NSHTMLPboardType | |
NSPDFPboardType | |
NSPICTPboardType | |
NSPostScriptPboardType | |
NSRTFPboardType | |
NSRTFDPboardType | |
NSRulerPboardType | |
NSSoundPboardType | |
NSStringPboardType | |
NSTabularTextPboardType | |
NSTIFFPboardType | |
NSURLPboardType | |
NSVCardPboardType | |
WebArchivePboardType |
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.
Copyright © 2009 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2009-01-20