且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

iPhone中的标签栏控制器

更新时间:2023-01-14 08:41:25

使用Tabbar委托并使用uiviewcontroller的参数实例调用poptorootviewcontroller方法。希望它可能对你有用。尝试以下代码

Use Tabbar delegate and using parameter instance of uiviewcontroller call poptorootviewcontroller method. Hope it may work for you. Try the following code

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
UINavigationController *navController = (UINavigationController*)tabBarController.selectedViewController;

[navController popToRootViewControllerAnimated:YES];
}