pushing UIViewController without Navigation Controller

本小妞迷上赌 提交于 2019-12-23 21:15:49

问题


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];

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.

Regards.


回答1:


FYI : without UINavigationController You can't push to another Controller . You can produce a Controller using

PresentViewController

 [self presentViewController:objPortrit animated:YES completion:^{    }];

For Ex:

 initViewController *MW = [initViewController alloc];
   MW = [self.storyboard instantiateViewControllerWithIdentifier:@"init"];
    [self presentViewController:MW animated:YES completion:^{

            }];

EDIT:

For your comment : 

after producing the ViewController with PresentViewController, You need to dismiss it to produce another ViewController .

You can get over from this , something like this in their respective ViewController Use his method. :

 -(void)viewDidDisappear {
[self dismissModalViewControllerAnimated:YES];
}


来源:https://stackoverflow.com/questions/17250894/pushing-uiviewcontroller-without-navigation-controller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!