There are A,B and C-View Controller.From A view controller, I used navigation push syntax to move to B.From B View Controller I used the same syntax to move to C.So that B becomes parent of C.Now I have to remove B View Controller from the stack.Can anyone suggest how to remove Parent View.When I press back button the page should redirect to A view controller From C view controller.
Asked
Active
Viewed 749 times
1 Answers
0
Use the popToViewController:animated: method provided by UINavigationController (details here)
You can get a reference to AViewController using the viewControllers property that UINavigationController provides
If your AViewController is the root vc of the nav controller, you can use the popToRootViewController:animated: method
lostInTransit
- 70,519
- 61
- 198
- 274
-
No, I just want to remove reference in place to that view controller I want to assign another view controller – Vignaya Apr 04 '16 at 05:20
-
Replace `BViewController` in `viewControllers` with `AnotherViewController`. But for the case you described (go back from C to A), pop would be more appropriate – lostInTransit Apr 04 '16 at 05:25
-
When I used pop its not getting pop.Because the reference of B get deleted .I have to replace some other rederence – Vignaya Apr 04 '16 at 05:56
-
Why are you deleting the reference of B? If you don't want to display it, use the popToViewController: method instead of deleting references. Ideally the viewcontroller stack should be left alone! – lostInTransit Apr 04 '16 at 06:06
-
Actually, I want to include reference A in place of B.If I used pop its simple getting pop .It's not going to the view what I need – Vignaya Apr 04 '16 at 06:18