2

我正在使用该方法在 if 条件下推送另一个 UIViewController :

initViewController *MW = [initViewController alloc];
MW = [self.storyboard instantiateViewControllerWithIdentifier:@"init"];
[self.navigationController pushViewController:MW animated:YES];

现在我改变了我的架构,我刚刚删除了我的导航控制器。这就是为什么,由于没有 NavigationController 存在,这些步骤将不再帮助我。现在我如何在不按下按钮的情况下推动另一个 ViewController -(IBAction) 。我只是想在 Storyboard 中使用它。

问候。

4

1 回答 1

3

仅供参考:没有 UINavigationController 你不能推送到另一个 Controller 。您可以使用生成控制器

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];
}
于 2013-06-22T12:52:42.540 回答