0
我正在其中如何在應用程序iOS中保存拍攝的照片?
1)我想拍攝照片的,我知道該怎麼做 2)現在我想只保存一個應用程序的指定文件夾中的圖片的應用程序的iPhone應用程序。有沒有可能這樣做。任何幫助將非常感激。
謝謝
我正在其中如何在應用程序iOS中保存拍攝的照片?
1)我想拍攝照片的,我知道該怎麼做 2)現在我想只保存一個應用程序的指定文件夾中的圖片的應用程序的iPhone應用程序。有沒有可能這樣做。任何幫助將非常感激。
謝謝
試試這個
可以在使用下面的代碼UIImagePickerControllerDelegate委託執行
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
//obtaining saving path
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *imagePath = [documentsDirectory stringByAppendingPathComponent:@"latest_photo.png"];
//extracting image from the picker and saving it
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if ([mediaType isEqualToString:@"public.image"]){
UIImage *editedImage = [info objectForKey:UIImagePickerControllerEditedImage];
NSData *webData = UIImagePNGRepresentation(editedImage);
[webData writeToFile:imagePath atomically:YES];
}
}
你穿過了這 - http://stackoverflow.com/questions/ 6821517 /保存-一個圖像到應用程序的文檔文件夾從 - 的UIView上-IOS –