我有一个故事板,看起来像这样:试图提出有关VC,其观点是不是在窗口层次模式的VC
这是它是如何工作的:InitialSlidingViewController
实例导航VC为topViewController
如下其.m文件:
-(void)viewDidLoad {
[super viewDidLoad];
self.topViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Navigation"];
}
后导航VC被实例化,它创建的基本功能,并设置为underLeftVC。这是使用ECSlidingViewController。这会创建一个使用平移手势的滑动菜单,与Facebook类似。
NavigationVC的rootVC是我的ItemsCDTVC。当我点击+按钮时,它会弹出一张操作表,让我从相机拍摄照片或从照片库中进行选择。但是,我希望它模式地继续到ManageItemVC并设置我刚刚选择/拍摄到它的UIImageView的图片。当我尝试到现在,它引发以下错误:
Warning: Attempt to present <ManageItemViewController: 0x81d52a0> on <InitialSlidingViewController: 0x8122ce0> whose view is not in the window hierarchy!
这是真的,因为InitialSlidingVC是不是在屏幕上,ItemCDTVC是,但我要如何解决这个问题?
我已经在我的故事板中设置了模式类型segue,其底部的灵活空间中有一个标识符(当点击时,它没有任何操作,所以我选择了创建视觉轮廓)。这是我在项目CDTVC中的segue代码:
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// let's get the edited image
UIImage *image = info[UIImagePickerControllerEditedImage];
// but if for some reason we disable editing in the future, this is our safeguard
if(!image) image = info[UIImagePickerControllerOriginalImage];
if(image) {
self.pictureImageView.image = image;
[self performSegueWithIdentifier:@"addItemSegue" sender:self];
}
[self dismissViewControllerAnimated:YES completion:nil];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([segue.identifier isEqualToString:@"addItemSegue"]){
ManageItemViewController *manageItemVC = (ManageItemViewController *)[segue destinationViewController];
manageItemVC.pictureImageView = self.pictureImageView;
}
}
尝试呈现模态VC时失败。
优秀。不仅在解雇后,而且在完成块中。 – Camus 2014-02-19 01:29:13