Instance Method


Implemented by an owner object to provide promised data.


- (void)pasteboard:(NSPasteboard *)sender provideDataForType:(NSPasteboardType)type;



The pasteboard that requires the specified data for a paste operation.


The type of data the owner object must provide.


The receiver should have been previously declared in a declareTypes:owner: message.

The requested data should be written to sender using the setData:forType:, setPropertyList:forType:, or setString:forType: method. The pasteboard:provideDataForType: messages may also be sent to the owner when the application is shut down through an application’s terminate: method. This is the method that is invoked in response to a Quit command. Thus the user can copy something to the pasteboard, quit the application, and still paste the data that was copied. A pasteboard:provideDataForType: message is sent only if the specified type of data has not already been supplied to the pasteboard. Instead of writing all data types when the cut or copy operation is done, an application can choose to implement this method to provide the data for certain types only when they are requested.

If an application writes data to the pasteboard in the richest, and therefore most preferred, type at the time of a cut or copy operation, its pasteboard:provideDataForType: method can simply read that data from the pasteboard, convert it to the requested type, and write it back to the pasteboard as the new type.

See Also