2
我使用這個方法來進行屏幕捕獲:如何從照片庫中獲取最後一張照片的路徑?
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage*theImage=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(theImage, nil, nil, nil);
,我想獲得路徑那張照片,所以我可以用Instagram的方法使用它
NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", lastphotoTaken]];
// NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", lastphotoTaken]];
self.dic.UTI = @"com.instagram.exclusivegram";
self.dic = [self setupControllerWithURL:igImageHookFile usingDelegate:self];
self.dic=[UIDocumentInteractionController interactionControllerWithURL:igImageHookFile];
self.dic.annotation = [NSDictionary dictionaryWithObject:@"Here Give what you want to share" forKey:@"InstagramCaption"];
[self.dic presentOpenInMenuFromRect: rect inView: self.view animated: YES ];
感謝名單
感謝,但我的圖片的網址是:'資產庫://asset/asset.JPG ID = 7D636703-8786-465D-B896-A0A67F0B0CCE及EXT = JPG'如何轉換它以這種方式'文件:// ...' – AsimNet
@AsimNet:你不能用資產網址來做到這一點。或者將圖像存儲到文檔目錄而不是photolibrary –