Question

I have a Navigation Controller with a UITableViewController that I'm allowing the user to re-order the cells. Let's say the User ends up setting the Cells as shown in RootViewController (Picture Below).

As you can see indexPath.row:0 points to Scene 4 indexPath.row:1 points to Scene 2 indexPath.row:2 points to Scene 3 indexPath.row:3 points to Scene 7 indexPath.row:4 points to Scene 1

Question: Now when the User taps the Next Button on the Navigation Bar of RootViewController, I would like the scenes to somehow rearrange themselves and the stack becomes:

Scene 4 will appear first with Next Button that pushes Scene 2.
At Scene 2, the Next Button pushes Scene 3.
At Scene 3, the Next Button pushes Scene 7. At Scene 7, the Next Button pushes Scene 1.

And when the User hits the back button, Scenes pop in the same order: Scene1 to Scene 7 to Scene 3 to Scene 2 to Scene 4 and finally back to the RootViewController

I'm using Storyboard with Xcode 4.6.3. Designing for iOS6.

Thank you!

enter image description here

Was it helpful?

Solution

Instead of using Storyboard, you can always use Objective-C to do the logic.

Make use of [self pushViewController:vc]; and [self popViewController:vc]; ( or even [self popToRootViewController:animated:]; ), you can arrange the view controllers in the logic you decided.

By default, UINavigationController will handle "return path" once you pushed the view controllers to it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top