开发者

Resets the stacks view when the root controller is a tab bar controller

I have a tab bar controller and in both tab bar开发者_如何学JAVA items i have a nav controller in each. I would like that whenever a user goes away and back to a tab bar item it resets the nav controller.

If I've been navigating in one of the tab bar and then i press another tab item and go back it takes me to the beginning of the navigation.

Any ideas?

Thanks,


Set yourself to be the delegate of the tabBarController, and whenever you get a -tabBarController:shouldSelectViewController: message, call -popToRootViewController on your tab's navigation controller.


Here is what it works for me...

I made the appDelegate a UITableBarViewControllerDelegate too.

@interface InterfacesAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {

After, In IB I connected the tabbarcontrollerDelegate to the appDelegate. In this case Interfaces App Delegate

As Ben said, I then implemented the abBarController:shouldSelectViewController under InterfacesAppDelegate.m

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜