如果我评论保存照片的代码,我可以预览照片,如果我评论预览照片的代码,我可以将照片保存到相机胶卷
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
[self.library saveImage:image toAlbum:@"Testing" withCompletionBlock:^(NSError *error) {
if (error!=nil) {
NSLog(@"Big error: %@", [error description]);
}
}];
[picker dismissModalViewControllerAnimated:NO];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
photoPreview.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
}
答案 0 :(得分:0)
好吧,如果你正在评论其中一个当然不会起作用。你必须合并这些方法。
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
photoPreview.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
[self.library saveImage:image toAlbum:@"Testing" withCompletionBlock:^(NSError *error) {
if (error!=nil) {
NSLog(@"Big error: %@", [error description]);
}
}];
[picker dismissModalViewControllerAnimated:NO];
}