user2771150
user2771150

Reputation: 722

uinavigationcontroller - display stack

I'm currently working on an app that contains a large number of ViewControllers. I'm using uinavigationcontroller to push the a ViewController onto the stack and pop to a previous view controller when a back button is pressed. How would i display the viewcontrollers on the stack on a side bar. For example, the navigation process would look like this. ViewController1->ViewController2->ViewController3->ViewController4->ViewController5.

The side bar would look like this when navigated to ViewController5.

ViewController1
ViewController2
ViewController3
ViewController4
ViewController5

The user can then select any viewcontroller from the side bar, (e.g. ViewController3) and navigate to that ViewController without altering what's displayed on the sidebar.

Upvotes: 0

Views: 52

Answers (1)

Charith
Charith

Reputation: 88

use [navController setViewControllers:animated] to do whatever you want

NSMutableArray *controllers = [NSMutableArray arrayWithArray: inNavController.viewControllers];

// Do whatever you want with the array. Change Order add/remove view controllers.
[inNavController setViewControllers:controllers animated:YES];

Upvotes: 1

Related Questions