I have a UIViewCOntroller, and my code is as follows.
TviewController *tviewController = [[TviewController alloc]init];
[self.navigationController pushViewController:tviewController animated:YES];
Now from TviewController i go to another viewCOntroller;
XviewController *xviewController = [[XviewController alloc]init];
[self.navigationController pushViewController:xviewController animated:YES];
in this XviewController there is a button, when i click that button i need to move BACK to the TviewController How do i do this programatically ?
note: I don’t want to use pushViewController and push it further. I need to go back to the TviewController (as in clicking the back button twice)
there is 3 possible ways.
use
popToRootViewControllerAnimated:-> to go back root view controller (first view controller)use
popViewControllerAnimated:-> to go backward 1. it’s exact same way as back button.use
popToViewController:animated:-> to go back toUIViewControlleryou want (as long as it’s stack at back).point 1 & 2 is pretty easy to implement and other answers lead you to there.
for point 3, here it is: