Reputation: 307
I have 3 viewcontrollers the second one is added to the first using
viewcontroller1.m
:
[self presentModalViewController:vc2 animated:YES];
vc2.view.superview.frame = CGRectMake(50, 740, 695, 245);
now I want to navigate from the second to my third viewcontroller , I used in my viewcontroller2.m
:
[self.navigationController pushViewController:vc3 animated:YES];
but didn't work. This is what I want to do : viewcontroller1-->viewcontroller2(navigate and pass an object to viewcontroller3)-->viewcontroller3
Upvotes: 0
Views: 139
Reputation: 4452
View controllers do not normally bring an UINavigationController by default. When you are presenting a modal view controller, you are losing that source's navigation controller. You can create a new navigation controller, associate it with vc2, and present that modal view controller modally. something like:
UINavigationController *controller=[[UINavigationController alloc] initWithRootViewController:vc2];
[self presentModalViewController:controller animated:YES];
Upvotes: 1