解除UIImagePickerController而不重新加载其rootViewController

时间:2016-09-16 00:47:35

标签: ios uiviewcontroller uiimagepickercontroller

如果我在childViewController上呈现UIImagePickerController,请执行以下操作:

-(void)presentImagePicker{
    UIViewController *childVC = [[UIViewController alloc] init];

    [self addChildViewController:childVC];

    ImagePickerController *imagePicker = [[ImagePickerController alloc] init];
    imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    imagePicker.delegate = self;

    [childVC presentViewController:imagePicker animated:YES completion:nil];
}

当我解雇childView时:

-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
    NSArray *childVCArray = [self childViewControllers];

    [[childVCArray firstObject] dismissViewControllerAnimated:YES completion:nil];
}

rootViewController被重新初始化。

如何防止此行为?

0 个答案:

没有答案