| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.0 and later. |
| Declared in | NSPasteboard.h |
| Companion guides | |
| Related sample code |
NSPasteboard objects transfer data to and from the pasteboard server. The server is shared by all running applications. It contains data that the user has cut or copied, as well as other data that one application wants to transfer to another. NSPasteboard objects are an application’s sole interface to the server and to all pasteboard operations.
An NSPasteboard object is also used to transfer data between applications and service providers listed in each application’s Services menu. The drag pasteboard (NSDragPboard) is used to transfer data that is being dragged by the user.
Important: This reference and the Pasteboard Programming Guide describe the API and behavior for Mac OS X v10.6 and later. To learn about the behavior on Mac OS X v10.5 and earlier, see “Pasteboard Programming Topics for Cocoa” in the Legacy Reference Library.
On Mac OS X v10.6 and later, a pasteboard can contain multiple items. You can directly write or read any object that implements the NSPasteboardWriting Protocol Reference or NSPasteboardReading Protocol Reference protocol respectively. This allows you to write and read common items such as URLs, colors, images, strings, attributed strings, and sounds without an intermediary object. Your custom classes can also implement these protocols for use with the pasteboard.
The writing methods available on Mac OS X v10.5 and earlier all operate on what is conceptually the first item on the pasteboard. They accept UTIs and pboard type strings. In a future release they may take only UTIs. On Mac OS X v10.6 and later, the writing methods such as setData:forType: still provide a convenient means of writing to the first pasteboard item, without having to create the first pasteboard item. For example, instead of
[pboard clearContents]; |
NSPasteboardItem *item = [[[NSPasteboardItem alloc] init] autorelease]; |
[item setData:data forType:type]; |
[pboard writeObjects:[NSArray arrayWithObject:item]]; |
you can write:
[pboard clearContents]; |
[pboard setData:data forType:type]; |
In addition to being more compact, this is also a little more efficient—it avoids the need to create a separate pasteboard item and array.
+ generalPasteboard
+ pasteboardByFilteringData:ofType:
+ pasteboardByFilteringFile:
+ pasteboardByFilteringTypesInPasteboard:
+ pasteboardWithName:
+ pasteboardWithUniqueName
– releaseGlobally
– readObjectsForClasses:options:
– pasteboardItems
– indexOfPasteboardItem:
– dataForType:
– propertyListForType:
– stringForType:
– availableTypeFromArray:
– canReadItemWithDataConformingToTypes:
– canReadObjectForClasses:options:
– types
+ typesFilterableTo:
These methods all operate on what is conceptually the first item on the pasteboard. They accept UTIs and pboard type strings. In a future release they may take only UTIs.
These methods all operate on what is conceptually the first item on the pasteboard. They accept UTIs and pboard type strings. In a future release they may take only UTIs.
Returns the general NSPasteboard object.
+ (NSPasteboard *)generalPasteboard
The general pasteboard.
Invokes pasteboardWithName: to obtain the pasteboard.
NSPasteboard.hCreates and returns a new pasteboard with a unique name that supplies the specified data in as many types as possible given the available filter services.
+ (NSPasteboard *)pasteboardByFilteringData:(NSData *)data ofType:(NSString *)type
The data to be placed on the pasteboard.
The type of data in the data parameter.
The new pasteboard object.
The returned pasteboard also declares data of the supplied type.
No filter service is invoked until the data is actually requested, so invoking this method is reasonably inexpensive.
NSPasteboard.hCreates and returns a new pasteboard with a unique name that supplies the specified file data in as many types as possible given the available filter services.
+ (NSPasteboard *)pasteboardByFilteringFile:(NSString *)filename
The filename to put on the pasteboard.
The new pasteboard object.
No filter service is invoked until the data is actually requested, so invoking this method is reasonably inexpensive.
NSPasteboard.hCreates and returns a new pasteboard with a unique name that supplies the specified pasteboard data in as many types as possible given the available filter services.
+ (NSPasteboard *)pasteboardByFilteringTypesInPasteboard:(NSPasteboard *)pasteboard
The original pasteboard object.
The new pasteboard object. This method returns the object in the pasteboard parameter if the pasteboard was returned by one of the pasteboardByFiltering... methods. This prevents a pasteboard from being expanded multiple times.
This process can be thought of as expanding the pasteboard, because the new pasteboard generally contains more representations of the data than pasteboard.
This method only returns the original types and the types that can be created as a result of a single filter; the pasteboard does not have defined types that are the result of translation by multiple filters.
No filter service is invoked until the data is actually requested, so invoking this method is reasonably inexpensive.
NSPasteboard.hReturns the pasteboard with the specified name.
+ (NSPasteboard *)pasteboardWithName:(NSString *)name
The name of the pasteboard. The names of standard pasteboards are given in “Pasteboard Names.”
The pasteboard associated with the given name, or a new NSPasteboard object if the application does not yet have a pasteboard object for the specified name.
Other names can be assigned to create private pasteboards for other purposes.
NSPasteboard.hCreates and returns a new pasteboard with a name that is guaranteed to be unique with respect to other pasteboards on the computer.
+ (NSPasteboard *)pasteboardWithUniqueName
The new pasteboard object.
This method is useful for applications that implement their own interprocess communication using pasteboards.
NSPasteboard.hReturns the data types that can be converted to the specified type using the available filter services.
+ (NSArray *)typesFilterableTo:(NSString *)type
The target data type.
An array of NSString objects containing the types that can be converted to the target data type.
The array also contains the original type.
NSPasteboard.hAdds promises for the specified types to the first pasteboard item.
- (NSInteger)addTypes:(NSArray *)newTypes owner:(id)newOwner
An array of NSString objects, each of which specifies a type of data that can be provided to the pasteboard.
The object that provides the data for the specified types.
If the data for those types is provided immediately, the owner can be nil. If the data for the added types will be provided lazily when requested from the pasteboard, an owner object must be provided that implements the -pasteboard:provideDataForType: method of the NSPasteboardOwner informal protocol.
The new change count, or 0 if there was an error adding the types.
This method adds promises for the specified types to the first pasteboard item.
You use this methods to declare additional types of data for the first pasteboard item in the receiver. You can also use it to replace existing types added by a previous declareTypes:owner: or addTypes:owner: message.
The newTypes parameter specifies the types of data you are promising to the pasteboard. The types should be ordered according to the preference of the source application, with the most preferred type coming first (typically, the richest representation). New types are added to the end of the list containing any existing types, if any.
If you specify a type that has already been declared, this method replaces the owner of that type with the value in newOwner. In addition, any data already already written to the pasteboard for that type is removed.
NSPasteboard.hScans the specified types for a type that the receiver supports.
- (NSString *)availableTypeFromArray:(NSArray *)types
An array of NSString objects specifying the pasteboard types your application supports, in preferred order.
The first pasteboard type in types that is available on the pasteboard, or nil if the receiver does not contain any of the types in types.
You use this method to determine the best representation available on the pasteboard. For example, if your application supports RTFD, RTF, and string data, then you might invoke the method as follows:
NSArray *supportedTypes = |
[NSArray arrayWithObjects: NSRTFDPboardType, NSRTFPboardType, NSStringPboardType, nil]; |
NSString *bestType = [[NSPasteboard generalPasteboard] |
availableTypeFromArray:supportedTypes]; |
If the pasteboard contains RTF and string data, then bestType would contain NSRTFPboardType. If the pasteboard contains none of the types in supportedTypes, then bestType would be nil.
You must send a types or availableTypeFromArray: message before reading any data from an NSPasteboard object. If you need to see if a type in the returned array matches a type string you have stored locally, use the isEqualToString: method to perform the comparison.
NSPasteboard.hReturns a Boolean value that indicates whether the receiver contains any items that conform to the specified UTIs.
- (BOOL)canReadItemWithDataConformingToTypes:(NSArray *)types
An array of NSString objects containing UTIs.
YES if the receiver contains any items that conform to the UTIs specified in types, otherwise NO.
NSPasteboard.hReturns a Boolean value that indicates whether the receiver contains any items that can be represented as an instance of any class in a given array.
- (BOOL)canReadObjectForClasses:(NSArray *)classArray options:(NSDictionary *)options
An array of class objects.
Classes in the array must conform to the NSPasteboardReading Protocol Reference protocol.
A dictionary that specifies options to refine the search for pasteboard items, for example to restrict the search to file URLs with particular content types. For valid dictionary keys, see “Pasteboard Reading Options.”
YES if the receiver contains any items that can be represented as an instance of a class specified in classArray, otherwise NO.
NSPasteboard.hReturns the receiver’s change count.
- (NSInteger)changeCount
The change count of the receiver.
The change count starts at zero when a client creates the receiver and becomes the first owner. The change count subsequently increments each time the pasteboard ownership changes.
The change count is also returned from clearContents and declareTypes:owner:. You can therefore record the change count at the time that you take ownership of the pasteboard and later compare it with the value returned from changeCount to determine whether you still have ownership.
NSPasteboard.hClears the existing contents of the pasteboard
- (NSInteger)clearContents
The change count of the receiver.
Clears the existing contents of the pasteboard, preparing it for new contents. This is the first step in providing data on the pasteboard.
NSPasteboard.hReturns the data for the specified type from the first item in the receiver that contains the type.
- (NSData *)dataForType:(NSString *)dataType
The type of data you want to read from the pasteboard. This value should be one of the types returned by types or availableTypeFromArray:.
A data object containing the data for the specified type from the first item in the receiver that contains the type, or nil if the contents of the pasteboard changed since they were last checked.
This method may also return nil if the pasteboard server cannot supply the data in time—for example, if the pasteboard’s owner is slow in responding to a pasteboard:provideDataForType: message and the interprocess communication times out.
Errors other than a timeout raise a NSPasteboardCommunicationException.
If nil is returned, the application should put up a panel informing the user that it was unable to carry out the paste operation.
For standard text data types such as string, RTF, and RTFD, the text data from each item is returned as one combined result separated by newlines.
NSPasteboard.hPrepares the receiver for a change in its contents by declaring the new types of data it will contain and a new owner.
- (NSInteger)declareTypes:(NSArray *)newTypes owner:(id)newOwner
An array of NSString objects that specify the types of data that may be added to the new pasteboard. The types should be ordered according to the preference of the source application, with the most preferred type coming first (typically, the richest representation).
The object responsible for writing data to the pasteboard, or nil if you provide data for all types immediately. If you specify a newOwner object, it must support all of the types declared in the newTypes parameter and must remain valid for as long as the data is promised on the pasteboard.
The receiver's new change count.
This method is the equivalent of invoking clearContents, implicitly writing the first pasteboard item, and then callingaddTypes:owner: to promise types for the first pasteboard item.
declareTypes:owner: message essentially changes the contents of the receiver: It invalidates the current contents of the receiver and increments its change count.In general, you should not use this method with writeObjects:, since writeObjects: will always write additional items to the pasteboard, and will not affect items already on the pasteboard, including the item implicitly created by this method.
– clearContents– addTypes:owner:– changeCount– pasteboard:provideDataForType: (NSPasteboardOwner Informal Protocol)NSPasteboard.hReturns the index of the specified pasteboard item.
- (NSUInteger)indexOfPasteboardItem:(NSPasteboardItem *)pasteboardItem
A pasteboard item.
The index of the specified pasteboard item. If pasteboardItem has not been added to any pasteboard, or is owned by another pasteboard, returns NSNotFound.
An item’s index in the pasteboard is useful for a pasteboard item data provider that has promised data for multiple items, to be able to easily match the pasteboard item to an array of source data from which to derive the promised data.
NSPasteboard.hReturns the receiver’s name.
- (NSString *)name
The name of the receiver.
NSPasteboard.hReturns all the items held by the receiver.
- (NSArray *)pasteboardItems
Returns all the items held by the receiver, or nil if there is an error retrieving pasteboard items.
NSPasteboard.hReturns the property list for the specified type from the first item in the receiver that contains the type.
- (id)propertyListForType:(NSString *)dataType
The pasteboard data type containing the property-list data.
The property list for the specified type from the first item in the receiver that contains the type. This object consists of NSArray, NSData, NSDictionary, or NSString objects—or any combination thereof.
This method invokes the dataForType: method.
You must send types or availableTypeFromArray: before invoking propertyListForType:.
NSPasteboard.hReads data representing a file’s contents from the receiver and writes it to the specified file.
- (NSString *)readFileContentsType:(NSString *)type toFile:(NSString *)filename
The pasteboard data type to read. You should generally specify a value for this parameter. If you specify nil, the filename extension (in combination with the NSCreateFileContentsPboardType function) is used to determine the type.
The file to receive the pasteboard data.
The name of the file into which the data was actually written.
Data of any file contents type should only be read using this method. If data matching the specified type is not found on the pasteboard, data of type NSFileContentsPboardType is requested.
You must send an availableTypeFromArray: or types message before invoking readFileContentsType:toFile:.
NSPasteboard.hReads data representing a file’s contents from the receiver and returns it as a file wrapper.
- (NSFileWrapper *)readFileWrapper
A file wrapper containing the pasteboard data, or nil if the receiver contained no data of type NSFileContentsPboardType.
In Mac OS X v10.5 and earlier, the file contents pboard type allowed you to synthesize a pboard type for a file's contents based on the file's extension. In Mac OS X v10.5 and later, using the UTI of a file to represent its contents now replaces this functionality.
NSPasteboard.hReads from the receiver objects that best match the specified array of classes.
- (NSArray *)readObjectsForClasses:(NSArray *)classArray options:(NSDictionary *)options
An array of class objects.
The classes should appear in the array in the order the preferred order of representation. Classes in the array must conform to the NSPasteboardReading Protocol Reference protocol.
A dictionary that specifies options to refine the search for pasteboard items, for example to restrict the search to file URLs with particular content types. For valid dictionary keys, see “Pasteboard Reading Options.”
An array containing the best match (if any) for each of the items on the receiver that can be represented by a class specified in classArray. Returns nil if there is an error in retrieving the requested items from the pasteboard, or if no objects of the specified classes can be created.
Classes in classArray must implement the NSPasteboardReading protocol. Cocoa classes that implement this protocol include NSImage, NSString, NSURL, NSColor, NSAttributedString, and NSPasteboardItem. For every item on the pasteboard, each class in the provided array will be queried for the types it can read using readableTypesForPasteboard:. An instance is created of the first class found in the provided array whose readable types match a conforming type contained in that pasteboard item. Any instances that could be created from pasteboard item data is returned to the caller. Additional options, such as restricting the search to file URLs with particular content types, can be specified with an options dictionary.
Only objects of the requested classes are returned. You can always ensure to receive one object per item on the pasteboard by including the NSPasteboardItem class in the array of classes.
Consider the following example: there are five items on the pasteboard, two contain TIFF data, two contain RTF data, one contains a private data type. The following table shows what objects you get back in the returned array for different classes in classArray
Classes in classArray | Returned objects |
|---|---|
| Two |
| Two |
| Two |
| Two |
NSPasteboard.hReleases the receiver’s resources in the pasteboard server.
- (void)releaseGlobally
After this method is invoked, no other application can use the receiver.
A temporary, privately named pasteboard can be released this way when it is no longer needed, but a standard pasteboard should never be released globally.
NSPasteboard.hSets the given data as the representation for the specified type for the first item on the receiver.
- (BOOL)setData:(NSData *)data forType:(NSString *)dataType
The data to write to the pasteboard.
The type of data in the data parameter. The type must have been declared by a previous declareTypes:owner: message.
YES if the data was written successfully, otherwise NO if ownership of the pasteboard has changed. Any other error raises an NSPasteboardCommunicationException.
NSPasteboard.hSets the given property list as the representation for the specified type for the first item on the receiver.
- (BOOL)setPropertyList:(id)propertyList forType:(NSString *)dataType
The property list data to write to the pasteboard.
The type of property-list data in the propertyList parameter. The type must have been declared by a previous declareTypes:owner: message.
YES if the data was written successfully, otherwise NO if ownership of the pasteboard has changed. Any other error raises an NSPasteboardCommunicationException.
This method invokes setData:forType: with a serialized property list parameter.
NSPasteboard.hSets the given string as the representation for the specified type for the first item on the receiver.
- (BOOL)setString:(NSString *)string forType:(NSString *)dataType
The string to write to the pasteboard.
The type of string data. The type must have been declared by a previous declareTypes:owner: message.
YES if the data was written successfully, otherwise NO if ownership of the pasteboard has changed. Any other error raises an NSPasteboardCommunicationException.
This method invokes setData:forType: to perform the write.
NSPasteboard.hReturns a concatenation of the strings for the specified type from all the items in the receiver that contain the type.
- (NSString *)stringForType:(NSString *)dataType
The pasteboard data type to read.
A concatenation of the strings for the specified type from all the items in the receiver that contain the type, or nil if none of the items contain strings of the specified type.
This method invokes dataForType: to obtain the string. If the string cannot be obtained, stringForType: returns nil. See dataForType: for a description of what will cause nil to be returned.
In Mac OS X v10.6 and later, if the receiver contains multiple items that can provide string, RTF, or RTFD data, the text data from each item is returned as a combined result separated by newlines.
You must send types or availableTypeFromArray: before invoking stringForType:.
NSPasteboard.hReturns an array of the receiver’s supported data types.
- (NSArray *)types
An array of NSString objects containing the union of the types of data declared for all the pasteboard items on the receiver. The returned types are listed in the order they were declared.
You must send a types or availableTypeFromArray: message before reading any data from an NSPasteboard object. If you need to see if a type in the returned array matches a type string you have stored locally, use the isEqualToString: method to perform the comparison.
NSPasteboard.hWrites the contents of the specified file to the pasteboard.
- (BOOL)writeFileContents:(NSString *)filename
The name of the file to write to the pasteboard.
YES if the data was successfully written, otherwise NO.
Writes the contents of the file filename to the receiver and declares the data to be of type NSFileContentsPboardType and also of a type appropriate for the file’s extension (as returned by the NSCreateFileContentsPboardType function when passed the files extension), if it has one.
NSPasteboard.hWrites the serialized contents of the specified file wrapper to the pasteboard.
- (BOOL)writeFileWrapper:(NSFileWrapper *)wrapper
The file wrapper to write to the pasteboard.
YES if the data was successfully written, otherwise NO.
Writes the serialized contents of the file wrapper wrapper to the receiver and declares the data to be of type NSFileContentsPboardType and also of a type appropriate for the file’s extension (as returned by the NSCreateFileContentsPboardType function when passed the files extension), if it has one. If wrapper does not have a preferred filename, this method raises an exception.
NSPasteboard.hWrites an array of objects to the receiver.
- (BOOL)writeObjects:(NSArray *)objects
An array of objects that implement the NSPasteboardWriting Protocol Reference protocol (including instances of NSPasteboardItem).
YES if the array was successfully added, otherwise NO.
NSPasteboard.hThe NSPasteboard class defines the following named pasteboards.
NSString *NSGeneralPboard; NSString *NSFontPboard; NSString *NSRulerPboard; NSString *NSFindPboard; NSString *NSDragPboard;
NSGeneralPboardThe pasteboard that’s used for ordinary cut, copy, and paste operations.
This pasteboard holds the contents of the last selection that’s been cut or copied.
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
NSFontPboardThe pasteboard that holds font and character information and supports Copy Font and Paste Font commands that may be implemented in a text editor.
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
NSRulerPboardThe pasteboard that holds information about paragraph formats in support of the Copy Ruler and Paste Ruler commands that may be implemented in a text editor.
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
NSFindPboardThe pasteboard that holds information about the current state of the active application’s find panel.
This information permits users to enter a search string into the find panel, then switch to another application to conduct another search.
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
NSDragPboardThe pasteboard that stores data to be moved as the result of a drag operation.
For additional information on working with the drag pasteboard, see Drag and Drop Programming Topics for Cocoa.
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
AppKit/NSPasteboard.hThe NSPasteboard class uses the following constants to define UTIs for common pasteboard data types.
NSString *const NSPasteboardTypeString; NSString *const NSPasteboardTypePDF; NSString *const NSPasteboardTypeTIFF; NSString *const NSPasteboardTypePNG; NSString *const NSPasteboardTypeRTF; NSString *const NSPasteboardTypeRTFD; NSString *const NSPasteboardTypeHTML; NSString *const NSPasteboardTypeTabularText; NSString *const NSPasteboardTypeFont; NSString *const NSPasteboardTypeRuler; NSString *const NSPasteboardTypeColor; NSString *const NSPasteboardTypeSound; NSString *const NSPasteboardTypeMultipleTextSelection; NSString *const NSPasteboardTypeFindPanelSearchOptions;
NSPasteboardTypeStringString data.
Available in Mac OS X v10.6 and later.
Declared in NSPasteboard.h.
NSPasteboardTypePDFPDF data.
Available in Mac OS X v10.6 and later.
Declared in NSPasteboard.h.
NSPasteboardTypeTIFFTag Image File Format (TIFF) data.
Available in Mac OS X v10.6 and later.
Declared in NSPasteboard.h.
NSPasteboardTypePNGPNG image data.
Available in Mac OS X v10.6 and later.
Declared in NSPasteboard.h.
NSPasteboardTypeRTFRich Text Format (RTF) data.
Available in Mac OS X v10.6 and later.
Declared in NSPasteboard.h.
NSPasteboardTypeRTFDRTFD formatted file contents.
Available in Mac OS X v10.6 and later.
Declared in NSPasteboard.h.
NSPasteboardTypeHTMLHTML data.
Available in Mac OS X v10.6 and later.
Declared in NSPasteboard.h.
NSPasteboardTypeTabularTextAn NSString object containing tab-separated fields of text.
Available in Mac OS X v10.6 and later.
Declared in NSPasteboard.h.
NSPasteboardTypeFontFont and character information.
Available in Mac OS X v10.6 and later.
Declared in NSPasteboard.h.
NSPasteboardTypeRulerParagraph formatting information.
Available in Mac OS X v10.6 and later.
Declared in NSPasteboard.h.
NSPasteboardTypeColorColor data (an NSColor object).
Available in Mac OS X v10.6 and later.
Declared in NSPasteboard.h.
NSPasteboardTypeSoundSound data (an NSSound object).
Available in Mac OS X v10.6 and later.
Declared in NSPasteboard.h.
NSPasteboardTypeMultipleTextSelectionMultiple text selection.
Available in Mac OS X v10.6 and later.
Declared in NSPasteboard.h.
NSPasteboardTypeFindPanelSearchOptionsType for the Find panel metadata property list.
Available in Mac OS X v10.6 and later.
Declared in NSPasteboard.h.
The NSPasteboard class uses the following common pasteboard data types.
NSString *NSStringPboardType; NSString *NSFilenamesPboardType; NSString *NSPostScriptPboardType; NSString *NSTIFFPboardType; NSString *NSRTFPboardType; NSString *NSTabularTextPboardType; NSString *NSFontPboardType; NSString *NSRulerPboardType; NSString *NSFileContentsPboardType; NSString *NSColorPboardType; NSString *NSRTFDPboardType; NSString *NSHTMLPboardType; NSString *NSPICTPboardType; NSString *NSURLPboardType; NSString *NSPDFPboardType; NSString *NSVCardPboardType; NSString *NSFilesPromisePboardType; NSString *NSMultipleTextSelectionPboardType;
NSColorPboardTypeNSColor data.
On Mac OS X v10.6 and later, use NSPasteboardTypeColor (and you read and write colors directly to and from the pasteboard).
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
NSFileContentsPboardTypeA representation of a file’s contents.
The file contents pboard type allowed you to synthesize a pboard type for a file's contents based on the file's extension.
On Mac OS X v10.6 and later, you should use the UTI of a file to represent its contents instead.
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
NSFilenamesPboardTypeAn array of NSString objects designating one or more filenames.
On Mac OS X v10.6 and later, use writeObjects: to write file URLs to the pasteboard.
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
NSFontPboardTypeFont and character information.
On Mac OS X v10.6 and later, use NSPasteboardTypeFont instead.
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
NSHTMLPboardTypeHTML (which an NSTextView object can read from, but not write to).
On Mac OS X v10.6 and later, use NSPasteboardTypeHTML instead.
Available in Mac OS X v10.1 and later.
Declared in NSPasteboard.h.
NSPDFPboardTypePDF data.
On Mac OS X v10.6 and later, use NSPasteboardTypePDF instead.
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
NSPICTPboardTypeQuickDraw picture data.
The PICT format was formally deprecated in Mac OS X v10.4 along with QuickDraw. You should not be explicitly providing or looking for PICT data on the pasteboard.
To aid in this deprecation, if PICT is the only image type on the pasteboard, as is sometimes the case when copying images from 32-bit Carbon applications, a translated image type will be automatically reported and provided by NSPasteboard. The translated type is added to the types array ahead of PICT so that the deprecated PICT format is not the preferred format. In addition, when an application provides image data to NSPasteboard, the Carbon Pasteboard Manager will automatically make a PICT translation available to 32-bit Carbon applications.
Although NSPICTPboardType, and its UTI equivalent kUTTypePICT, will appear in a pasteboard's type array retrieved from the existing NSPasteboard API, it may cease to be reported in future releases.
Available in Mac OS X v10.0 and later.
Deprecated in Mac OS X v10.6.
Declared in NSPasteboard.h.
NSPostScriptPboardTypeEncapsulated PostScript (EPS) code.
On Mac OS X v10.6 and later, use @"com.adobe.encapsulated-postscript" instead.
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
NSRulerPboardTypeParagraph formatting information.
On Mac OS X v10.6 and later, use NSPasteboardTypeRuler instead.
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
NSRTFPboardTypeRich Text Format (RTF) data.
On Mac OS X v10.6 and later, use NSPasteboardTypeRTF instead.
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
NSRTFDPboardTypeRTFD formatted file contents.
On Mac OS X v10.6 and later, use NSPasteboardTypeRTFD instead.
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
NSStringPboardTypeNSString data. (Deprecated. On Mac OS X v10.6 and later, use NSPasteboardTypeString instead.)
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
NSTabularTextPboardTypeAn NSString object containing tab-separated fields of text.
On Mac OS X v10.6 and later, use NSPasteboardTypeTabularText instead.
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
NSTIFFPboardTypeTag Image File Format (TIFF) data.
On Mac OS X v10.6 and later, use NSPasteboardTypeTIFF instead.
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
NSURLPboardTypeNSURL data for one file or resource.
On Mac OS X v10.6 and later, use writeObjects: to write URLs directly to the pasteboard instead.
On Mac OS X v10.5 and earlier: to write an URL to a pasteboard you use writeToPasteboard: (NSURL); to get an URL from a pasteboard you use URLFromPasteboard: (NSURL).
Available in Mac OS X v10.0 and later.
Declared in NSPasteboard.h.
NSVCardPboardTypeVCard data.
On Mac OS X v10.6 and later, use (NSString *)kUTTypeVCard instead.
Available in Mac OS X v10.2 and later.
Declared in NSPasteboard.h.
NSFilesPromisePboardTypePromised files.
On Mac OS X v10.6 and later, use (NSString *)kPasteboardTypeFileURLPromise instead.
For information on promised files, see Dragging Files in Drag and Drop Programming Topics for Cocoa.
Available in Mac OS X v10.2 and later.
Declared in NSPasteboard.h.
NSInkTextPboardTypeInk text data.
On Mac OS X v10.6 and later, use (NSString *)kUTTypeInkText instead.
For information on ink text objects, see Using Ink Services in Your Application.
Available in Mac OS X v10.4 and later.
Declared in NSPasteboard.h.
NSMultipleTextSelectionPboardTypeMultiple text selection.
On Mac OS X v10.6 and later, use NSPasteboardTypeMultipleTextSelection instead.
Available in Mac OS X v10.5 and later.
Declared in NSPasteboard.h.
See also NSSoundPboardType (NSSound).
Pboard types will be deprecated in a future release. On Mac OS X 10.6 and later you should replace any use of pboard types with UTIs, including the constants described in “Types for Standard Data (Mac OS X 10.6 and later).”
These options can be used for both the readObjectsForClasses:options: and canReadObjectForClasses:options: methods, unless otherwise specified. The currently available options allow for customization of how URLS are read from the pasteboard.
NSString *NSPasteboardURLReadingFileURLsOnlyKey; NSString *NSPasteboardURLReadingContentsConformToTypesKey;
NSPasteboardURLReadingFileURLsOnlyKeyOption for reading URLs to restrict the results to file URLs only.
The value for this key is an NSNumber object with a boolean value.
Available in Mac OS X v10.6 and later.
Declared in NSPasteboard.h.
NSPasteboardURLReadingContentsConformToTypesKeyOption for reading URLs to restrict the results to URLs with contents that conform to any of the provided UTI types.
If the content type of a URL cannot be determined, it will not be considered to match. The value for this key is an array of UTI type strings.
Available in Mac OS X v10.6 and later.
Declared in NSPasteboard.h.
Last updated: 2009-11-17