Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

push uiviewcontroller from presentModalViewController

I Show a view using presentModalViewController. and from this UIView I want to push a UIView using UINavigationController. I tried below code for this

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

But it did not works for me. so please can any one suggest how I push a view from ModelViewController.

Thanks

like image 489
Mitesh Khatri Avatar asked Jul 21 '11 08:07

Mitesh Khatri


1 Answers

First you have to present your modal view controller inside a navigation controller:

MyViewController *vc = [[MyViewController alloc] initWithNibName:@"MyNib" bundle:nil];
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:vc];

[self presentModalViewController:nc animated:YES];

[vc release];
[nc release];

Then inside MyViewController you can do:

OtherViewController *vc = [[OtherViewController alloc] initWithNibName:@"MyOtherNib" bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
[vc release];
like image 181
ySgPjx Avatar answered Sep 20 '22 15:09

ySgPjx