Rob
Rob

Reputation: 2786

How can I break the "navigation stack" in a Cocoa Touch App?

I'm currently trying to create a navigation based application, pushing views to change the screen content. I'm trying to set up a button which can allow me to "restart" from the first screen, but I can't figure out a way to do that.

If I "push" the first view, there will be a "back" button, and I'll just have another piece on the view stack. In fact, I'm want to reinitialize that stack.

Is it possible ? (Am I clear ? English is not my first language :) )

Upvotes: 0

Views: 105

Answers (1)

Vladimir
Vladimir

Reputation: 170849

To navigate to the 1st view in navigation stack (i.e. to the root controller) you can simply with just one call:

[self.navigationController popToRootViewControllerAnimated:YES];

If you want to change root controller as well I think you can do that using setViewControllers:animated: method

Upvotes: 2

Related Questions