ingh.am
ingh.am

Reputation: 26752

iPhone pop navigation controller when tab bar selected

I have an iPhone app with a tab bar and in the first tab there is a UINavigationController. How can I force the navigation controller to popToRoot when selecting the tab? The default behaviour does this the second time you select it but I wish to do it on the first one.

Thanks

Upvotes: 0

Views: 694

Answers (1)

Jeff Kelley
Jeff Kelley

Reputation: 19071

One way to do this would be to use UITabBarControllerDelegate’s –tabBarController:didSelectViewController: method to be notified when the user selects the navigation controller. Then, in that method, pop your navigation controller as desired.

Upvotes: 2

Related Questions