O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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;

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required