更新时间: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];
}