views:

132

answers:

2

Hey there,

I have a UINavigationController inside a UITabBarController. When a user presses the first tab, I want to reset the navigation controller back to the first screen instead of displaying whichever view they last selected in the navigation controller. Is there an easy way to reset the stack?

Thanks, Howie

+2  A: 

-[UINavigationController popToRootViewControllerAnimated:] should do what you want.

Ben Gottlieb
Thanks - did the trick. I have a rootTabBarViewController and all I had to do was listen to didSelectViewController to find out if the selected index is 0 then call popToRoot... and it worked!
Ward
+1  A: 

Check this thread: http://www.iphonedevsdk.com/forum/iphone-sdk-development/2625-uinavigationcontroller-uitabbarcontroller.html

According to this thread you should reset the navigation controller in – tabBarController:didSelectViewController:

Piotr Czapla