Search code examples
iphoneobjective-cuiviewcontrollernavigationpushviewcontroller

hide second viewcontroller and navigate to third viewcontroller


I am in ViewControllerA and other ViewControllerB is also loaded in the viewcontroller's stack.viewControllerB has camera screen also. From ViewControllerA I'm calling ViewControllerB by this below code:

AppNameAppDelegate *appDelegate = (AppNameAppDelegate *)[[UIApplication sharedApplication] delegate];
ViewControllerB *l_ViewControllerB = [appDelegate ViewControllerB];
l_ViewControllerB.view.hidden = NO;
[self.navigationController pushViewController:l_ViewControllerB animated:YES];

Now from ViewControllerB, I want to switch to ViewControllerC.

self.view.hidden = YES;
ViewControllerC *l_ViewControllerC = [[ViewControllerC alloc] init];
[self.navigationController pushViewController:l_ViewControllerC animated:YES];
[l_ViewControllerC release];

But its navigating to ViewControllerA which I don't need, so I need help, how to navigate to ViewControllerC without showing ViewControllerA.

Update: ViewControllerB is defined in ViewControllerB.mm file,there is some C++ coding is also involved in ViewControllerB.mm file. This will make any difference the ViewControllerB is defined in ViewControllerB.m or ViewControllerB.mm file?


Solution

  • Please try this may be helpful for you.