私がしたいのは、警告が表示された後、画像が保存されたか保存されていないことです。ピッカーを解除する必要がありますが、方法を見つけることができません。didFinishSavingWithErrorの後にイメージピッカーを解除するにはどうすればよいですか?
私はこのようなイメージコントロールを提示:
[self presentModalViewController:imagePicker animated:YES];
私はキャンセルした場合のためにそれを行うので、私は、dismissmodalviewcontrollerする必要がある知っているが、私はどこの画像の後になるように配置するかわかりませんそれが存在するセーブです。
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
}
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
UIAlertView *alert;
// Unable to save the image
if (error)
alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Unable to save image to Photo Album."
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
else // All is well
alert = [[UIAlertView alloc] initWithTitle:@"Success"
message:@"Image saved to Photo Album."
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}
質問を更新しました。私は一般的にそれを却下する方法を知っています。私はキャンセルのためにそれを却下していますが、警告が表示されたらそれを却下する方法はわかりません。 – Meme
あなたはもっと具体的になることができますか?インスタンスをローカルに作成するにはどうしたらいいですか? – Meme
UIImagePickerController * imagepickerを作成します。あなたのcontroller.hとalertviewのdelegte [self dismissModalViewControllerAnimated:TRUE]にあります。 http://zcentric.com/2008/08/28/using-a-uiimagepickercontroller/ – mChopsey