美文网首页
UIPasteboard使用

UIPasteboard使用

作者: lancely | 来源:发表于2016-04-24 15:52 被阅读162次
    • 基本使用
    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;
    

    相关文章

      网友评论

          本文标题:UIPasteboard使用

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