0

これはiOS6で機能したため、問題が何であるかはわかりません。

UINavigationController (ioNavController) 内で、UIImagePickerController に次のものを提示します。

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.modalInPopover = YES;
imagePicker.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:imagePicker animated:NO  completion:^{  }]; 

私のUIImagePickerControllerDelegate(呼び出されます)には、次のものがあります:

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {

    //This does not work
    [ioNavController dismissViewControllerAnimated:YES completion:^{ /* Cleanup if Needed */ }];

    //This does not work
    [[picker parentViewController] dismissViewControllerAnimated:YES completion:^{ /* Cleanup if Needed */ }];

    //This does not work
    [picker removeFromParentViewController];

    // This presents a new view on the Nav Controller. It shows the new view ontop of the ImagePicker. Image Picker View does not repond to touches. 
    [ioNavController pageToSelect:0];

}
4

2 に答える 2

0

このコードを使用すると、UIImagePickerController はそれ自体を削除します。

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)pPicker {
[pPicker dismissViewControllerAnimated:YES completition:NULL]; }
于 2015-02-22T19:31:40.287 に答える
0

あなたのデリゲートは、イメージピッカーを呼び出したのと同じコントローラーにありますか? 呼び出した同じコントローラーがpresentViewController以下の行を呼び出す必要があり、イメージピッカーは正しく削除されます。

[self dismissViewControllerAnimated:YES completion:nil]; //self here it's the same reference that called presentViewController

うまくいったか、助けられたかどうか教えてください。

于 2013-08-04T05:48:05.037 に答える