Type Method

imageRepWithPasteboard:

Creates and returns an image representation object using the contents of the specified pasteboard.

Declaration

+ (NSImageRep *)imageRepWithPasteboard:(NSPasteboard *)pasteboard;

Parameters

pasteboard

The pasteboard containing the image data.

Return Value

An initialized instance of an NSImageRep subclass, or nil if the image data could not be read.

Discussion

If sent to the NSImageRep class object, this method returns a newly allocated instance of a subclass of NSImageRep initialized with the data in the specified pasteboard. If sent to a subclass of NSImageRep that recognizes the data on the pasteboard, it returns an instance of that subclass initialized with that data.

This method returns nil in any of the following cases:

  • The message is sent to the NSImageRep class object and there are no subclasses in the NSImageRep class registry that handle data of the type contained in the specified pasteboard.

  • The message is sent to a subclass of NSImageRep and that subclass cannot handle data of the type contained in the specified pasteboard.

  • The NSImageRep subclass is unable to initialize itself with the contents of the pasteboard.

The NSImageRep subclass is initialized by creating an NSData object based on the data the specified pasteboard and passing it to the imageRepWithData: method.

See Also

Creating an Image Representation

+ imageRepsWithContentsOfFile:

Creates and returns an array of image representation objects initialized using the contents of the specified file.

+ imageRepsWithPasteboard:

Creates and returns an array of image representation objects initialized using the contents of the pasteboard.

+ imageRepsWithContentsOfURL:

Creates and returns an array of image representation objects initialized using the contents of the specified URL.

+ imageRepWithContentsOfFile:

Creates and returns an image representation object using the contents of the specified file.

+ imageRepWithContentsOfURL:

Creates and returns an image representation object using the data at the specified URL