2012-03-15 80 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