1
我有一个应用程序,我想在其中复制图像并将其粘贴到短信应用程序中。将图像复制到ios的粘贴板
我正在使用下面的代码。
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
NSString *filePath = [[NSBundle mainBundle]pathForResource:@"Heritage" ofType:@"png"];
NSData *data = [NSData dataWithContentsOfFile:filePath];
[pasteboard setData:data forPasteboardType:@"public.png"];
}
在谷歌搜索后,我有这个代码,并有大量的代码,但不知何故没有人似乎为我工作。
当我运行应用程序并转到短信应用程序并按下时,粘贴选项不会显示在那里。
Heritage.png是我的应用程序包中的图像。
我在哪里做错了?
请让我知道。
谢谢...