Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 295
Krunal Avatar asked Jan 11 '23 19:01

Krunal


1 Answers

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];
like image 84
Rahul Patel Avatar answered Jan 18 '23 09:01

Rahul Patel