Instance Method

valueForPasteboardType:

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

Declaration

- (id)valueForPasteboardType:(NSString *)pasteboardType;

Parameters

pasteboardType

A string identifying a representation type of a pasteboard item.

Return Value

An object that is an instance of the appropriate class based on pasteboardType or an NSData object containing “raw” data.

Discussion

This method attempts to return an object that is of a class type appropriate to the representation type, which typically is a UTI. For example, if the representation type is kUTTypePlainText (public.plain-text), the method returns an NSString object. If the method can’t determine the class type from the representation type, it returns the object as a generic object, such as an NSString, NSArray, NSDictionary, NSDate, NSNumber, NSURL, UIImage, or NSData object. This method works on the first item in the pasteboard. If there are other items, it ignores them.

See Also

Getting and Setting Single Pasteboard Items

- dataForPasteboardType:

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

- setData:forPasteboardType:

Puts data in the pasteboard for the specified representation type.

- setValue:forPasteboardType:

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