iOS打开复制文字,链接,图片到粘贴板

来源:互联网 发布:javascript 表格并排放 编辑:程序博客网 时间:2024/06/10 12:37


UIPasteboard 类


The UIPasteboard class enables an app to share data within the app and with another app. To share data with any other app, you can use system-wide pasteboards; to share data with another app that has the same team ID as your app, you can use app-specific pasteboards.


1 实例方法

+ (UIPasteboard *)generalPasteboard;

+ (UIPasteboard *)pasteboardWithName:(NSString *)pasteboardName create:(BOOL)create;

+ (UIPasteboard *)pasteboardWithUniqueName;


2 表示可复制的内容的属性

@property(nonatomic,copy)NSString *string;

@property(nonatomic,copy)NSArray *strings;


@property(nonatomic,copy)NSURL *URL;

@property(nonatomic,copy)NSArray *URLs;


@property(nonatomic,copy)UIImage *image;

@property(nonatomic,copy)NSArray *images;


@property(nonatomic,copy)UIColor *color;

@property(nonatomic,copy)NSArray *colors;



//复制string 将字符串复制到的系统的粘贴板上 在其它地方可以粘贴

- (void)copyToPasteBoard:(NSString *)str{

    UIPasteboard *pasteboard = [UIPasteboardgeneralPasteboard];

    [pasteboard setString:str];

    

}



0 0
原创粉丝点击