Instance Method

setValue:forPasteboardType:

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

Declaration

- (void)setValue:(id)value forPasteboardType:(NSString *)pasteboardType;

Parameters

value

The object to be written to the pasteboard.

pasteboardType

A string identifying the representation type of the pasteboard item. If the type is a UTI, it must be compatible with the class of value; otherwise, nothing is written to the pasteboard.

Discussion

Use this method to put an object—such as an NSString, NSArray, NSDictionary, NSDate, NSNumber, UIImage, or NSURL object—on the pasteboard. (For images, you can also use the image or images properties; for all other data, such as raw binary data, use the setData:forPasteboardType: method.) This method writes the object as 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.

- setData:forPasteboardType:

Puts data in the pasteboard for the specified representation type.