在没有导航控制器的情况下推送 UIViewController [英] pushing UIViewController without Navigation Controller
问题描述
我正在使用该方法在 if 条件下推送另一个 UIViewController :
I was using that method for pushing another UIViewController in if condition :
initViewController *MW = [initViewController alloc];
MW = [self.storyboard instantiateViewControllerWithIdentifier:@"init"];
[self.navigationController pushViewController:MW animated:YES];
现在我已经改变了我的架构,我刚刚删除了我的导航控制器.这就是为什么,由于不存在 NavigationController,这些步骤将不再对我有帮助.现在如何在不按下按钮的情况下推送另一个 ViewController -(IBAction) .我只是想在 Storyboard 中使用它.
Now i've changed my architecture and i just removed my Navigation controller. That's why , these steps will not help me any longer due to no NavigationController exist. Now how can i push another ViewController without pressing button -(IBAction) . I just wanted to use it in Storyboard.
问候.
推荐答案
仅供参考:没有 UINavigationController 你不能推送到另一个 Controller .您可以使用
FYI : without UINavigationController You can't push to another Controller . You can produce a Controller using
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 .
after producing the ViewController with PresentViewController, You need to dismiss it to produce another ViewController .
你可以从这个过来,像这样在他们各自的 ViewController 中使用他的方法.:
You can get over from this , something like this in their respective ViewController Use his method. :
-(void)viewDidDisappear {
[self dismissModalViewControllerAnimated:YES];
}
这篇关于在没有导航控制器的情况下推送 UIViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!