美文网首页
iOS UIPasteboard 剪切板的使用

iOS UIPasteboard 剪切板的使用

作者: 奋斗的小老鼠 | 来源:发表于2016-06-19 21:35 被阅读113次

·基本使用

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<NSString *> *strings;
@property(nullable,nonatomic,copy) NSURL *URL;
@property(nullable,nonatomic,copy) NSArray<NSURL *> *URLs;
@property(nullable,nonatomic,copy) UIImage *image;
@property(nullable,nonatomic,copy) NSArray<UIImage *> *images;
@property(nullable,nonatomic,copy) UIColor *color;
@property(nullable,nonatomic,copy) NSArray<UIColor *> *colors;

相关文章

网友评论

      本文标题:iOS UIPasteboard 剪切板的使用

      本文链接:https://www.haomeiwen.com/subject/mkgbdttx.html