2012-04-12 2 views
2

私がしたいのは、警告が表示された後、画像が保存されたか保存されていないことです。ピッカーを解除する必要がありますが、方法を見つけることができません。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]; 
} 

答えて

1

を使用しています。

+0

質問を更新しました。私は一般的にそれを却下する方法を知っています。私はキャンセルのためにそれを却下していますが、警告が表示されたらそれを却下する方法はわかりません。 – Meme

+0

あなたはもっと具体的になることができますか?インスタンスをローカルに作成するにはどうしたらいいですか? – Meme

+0

UIImagePickerController * imagepickerを作成します。あなたのcontroller.hとalertviewのdelegte [self dismissModalViewControllerAnimated:TRUE]にあります。 http://zcentric.com/2008/08/28/using-a-uiimagepickercontroller/ – mChopsey

0

あなたが使用している場合、それはどのように存在imagepickercontrollerに依存しているがpeserntmodelviewcontrolleranimated:そして、あなたは、単にそれを閉じ、ローカルおよびalertviewデリゲートメソッドでUIImagePickerControllerのインスタンスを作成する必要がありますdismissModalViewControllerAnimated:

関連する問題