2012-03-15 95 views
0

我试图将URL中的图像保存到剪贴板。我试过使用:将URL从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? 

但它不起作用。它不会给出警告,错误或任何事情。

回答

1

尝试此,

为了节省图像到剪贴板:

[UIPasteboard generalPasteboard] =图像配someImage;

从剪贴板再次获取图像出来:

的UIImage * someImage = [UIPasteboard generalPasteboard]图像配;

+0

好的,我一回家就会尝试(约4:30)。谢谢。 – 2012-03-15 11:57:46

+0

谢谢。它完美的作品。 – 2012-03-15 19:43:51