0

我正在尝试将图像从 URL 保存到剪贴板。我尝试使用:

NSURL *url = [NSURL URLWithString:fromURL];
NSData *imageData = [[NSData alloc] initWithContentsOfURL:url];
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
[pasteboard setData:imageData forPasteboardType:@"kUTTypeJPEG"]; //is kUTTypeJPEG even the right type?

但它不起作用。它不会给出警告、错误或任何东西。

4

1 回答 1

1

试试这个,

将图像保存到剪贴板:

[UIPasteboard generalPasteboard].image = someImage;

要从剪贴板中再次获取图像:

UIImage *someImage = [UIPasteboard generalPasteboard].image;

于 2012-03-15T05:42:34.707 回答