iOS UIPasteboard 剪切板的使用

·基本使用

UIPasteboard *pboard = [UIPasteboard generalPasteboard];
// 赋值
pboard.string = @"hello";
pboard.image = [UIImage imageNamed:@"xxx"];
// 取值
NSString *str = pboard.string;
UIImage *image = pboard.image;

·可以赋值的属性

@property(nullable,nonatomic,copy) NSString *string;
@property(nullable,nonatomic,copy) NSArray *strings;
@property(nullable,nonatomic,copy) NSURL *URL;
@property(nullable,nonatomic,copy) NSArray *URLs;
@property(nullable,nonatomic,copy) UIImage *image;
@property(nullable,nonatomic,copy) NSArray *images;
@property(nullable,nonatomic,copy) UIColor *color;
@property(nullable,nonatomic,copy) NSArray *colors;

你可能感兴趣的:(iOS UIPasteboard 剪切板的使用)