Krunal
Krunal

Reputation: 6490

How to PushViewController From modalViewController

I have FavouriteViewController in which i have one button on click of button i am presenting a view modally called LoginViewController (using storyboard)

On this page(LoginViewController), i again have button, on click of that i want to push my view controller.

Is it possible ?

Upvotes: 4

Views: 6236

Answers (3)

Hardik Mamtora
Hardik Mamtora

Reputation: 1652

Here it is

[self.parentViewController.navigationController pushViewController:newViewController animated:YES];

Upvotes: 0

Rahul Patel
Rahul Patel

Reputation: 5886

You can try below code.. It may help you to get your desired solution.

1) Present LoginViewController by write below code.

    LoginViewController *login = [[[LoginViewController alloc]initWithNibName:@"LoginViewController" bundle:nil]autorelease];
    UINavigationController *nc = [[[UINavigationController alloc] initWithRootViewController:login]autorelease];
    nc.navigationBar.hidden = YES;
    [self.navigationController presentModalViewController:nc animated:YES];

2) Now from LoginViewController, You can push your MyviewController as below.

    MyviewController *adss = [[[MyviewController alloc]initWithNibName:@"MyviewController" bundle:nil]autorelease];
    [self.navigationController pushViewController:adss animated:YES];

Upvotes: 7

freelancer
freelancer

Reputation: 1658

using UINavigationController

 UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:self.LoginViewController];
 [self presentModalViewController:nav animated:YES];

after this you can push any view controller from presented view controller(LoginViewController)

Upvotes: 2

Related Questions