如何在Objective C - Xcode 7.1中将标签的图像保存到UIPasteboard / Clipboard? 我已经尝试过这个代码了,但它只复制了文本。
[UIPasteboard generalPasteboard].string = helloField.text;
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = @"paste me somewhere";
是否还要复制图像,甚至只是自己复制图像?
答案 0 :(得分:0)
是的,你可以做到。
您需要使用以下方法将一个图像放入本机iOS粘贴板:
function clickSave() {
window.canvas2ImagePlugin.saveImageDataToLibrary(
function(msg){
alert(msg);
},
function(err){
alert(err);
},
document.getElementById('myCanvas')
);
}
您还可以将UIImages数组放到UIPasteboard中:
UIImage *image = [UIImage imageNamed:@"img.png"];
[[UIPasteboard generalPasteboard] setImage:image];
要了解更多信息,请阅读Apple UIPasteboard class reference.