Name

NSPasteboard — Mac OS X 10.0

Synopsis

This class provides access to the pasteboard server, which allows applications to share data with one another. A general purpose pasteboard is obtained using the class method generalPasteboard. Alternatively, clients can access one of the standard pasteboards (general, font, ruler, find, and drag), or create a private pasteboard using the class method pasteboardWithName:.

Data is read and written to a pasteboard using the methods dataForType: and setData:forType, respectively.

image with no caption

@interface NSPasteboard : NSObject
                                  // Convenience Constructors
   + (NSPasteboard *)pasteboardByFilteringData:(NSData *)data 
                                 ofType:(NSString *)type;
   + (NSPasteboard *)pasteboardByFilteringFile:(NSString *)filename;
   + (NSPasteboard *)pasteboardByFilteringTypesInPasteboard:(NSPasteboard *)pboard;
   + (NSPasteboard *)pasteboardWithName:(NSString *)name;
   + (NSPasteboard *)pasteboardWithUniqueName;
                                  // Accessor Methods
   - (BOOL)setString:(NSString *)string 
                                 forType:(NSString *)dataType;
   - (BOOL)setData:(NSData *)data 
                                 forType:(NSString *)dataType;
   - (BOOL)setPropertyList:(id)plist 
                                 forType:(NSString *)dataType;
                                  // Class Methods
   + (NSPasteboard *)generalPasteboard;
   + (NSArray *)typesFilterableTo:(NSString *)type;
                                  // Instance Methods
   - (NSString *)availableTypeFromArray:(NSArray *)types;
   - (int)addTypes:(NSArray *)newTypes 
                                 owner:(id)newOwner;

Get Cocoa in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.