CyReX
CyReX

Reputation: 1576

pushing UIViewController without Navigation Controller

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.

Upvotes: 2

Views: 8008

Answers (1)

Kumar KL
Kumar KL

Reputation: 15335

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

Upvotes: 3

Related Questions