Instance Method

setData:forPasteboardType:

Puts data in the pasteboard for the specified representation type.

Declaration

- (void)setData:(NSData *)data forPasteboardType:(NSString *)pasteboardType;

Parameters

data

The data object to be written to the pasteboard.

pasteboardType

A string identifying the representation type of the pasteboard item. This is typically a UTI.

Discussion

Use this method to put raw data on the pasteboard. For example, you could archive a graph of model objects and pass the resulting NSData object to a related app via a pasteboard using a custom pasteboard type. (To put objects—such as NSString, NSArray, NSDictionary, NSDate, NSNumber, UIImage, or NSURL objects—on the pasteboard, use the setValue:forPasteboardType: method.) This method writes data for the first item in the pasteboard. Calling this method replaces any items currently in the pasteboard.

See Also

Getting and Setting Single Pasteboard Items

- dataForPasteboardType:

Returns the data in the pasteboard for the given representation type.

- valueForPasteboardType:

Returns an object in the pasteboard for the given representation type.

- setValue:forPasteboardType:

Puts an object in the pasteboard for the specified representation type.