推的UIViewController没有导航控制器
问题描述:
我用这种方法在if条件推动另一UIViewController中:推的UIViewController没有导航控制器
initViewController *MW = [initViewController alloc];
MW = [self.storyboard instantiateViewControllerWithIdentifier:@"init"];
[self.navigationController pushViewController:MW animated:YES];
现在我已经改变了我的建筑,我只是删除我的导航控制器。这就是为什么,由于没有NavigationController存在,这些步骤不会再帮助我。现在我怎么能不按按钮 - (IBAction)推另一个ViewController。我只是想在Storyboard中使用它。
问候。
答
仅供参考:无UINavigationController无法推送到其他控制器。您可以使用生产
PresentViewController
[self presentViewController:objPortrit animated:YES completion:^{ }];
对于防爆一个控制器:
initViewController *MW = [initViewController alloc];
MW = [self.storyboard instantiateViewControllerWithIdentifier:@"init"];
[self presentViewController:MW animated:YES completion:^{
}];
编辑:
For your comment :
在使用PresentViewController生成ViewController之后,您需要关闭它以生成另一个ViewController。
你可以在它们各自的ViewController中使用他的方法来解决这个问题。 :
-(void)viewDidDisappear {
[self dismissModalViewControllerAnimated:YES];
}
非常感谢你的回答。它的工作原理和处理我所有的问题:D –
您R欢迎.... –
一个问题刚刚显示:) - 警告:尝试呈现其视图不在窗口层次结构中 ! –