如果我在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被重新初始化。
如何防止此行为?