gpt4 book ai didi

iphone - 从 UITabBarController 弹出 UIViewController

转载 作者:行者123 更新时间:2023-11-29 10:59:03 26 4
gpt4 key购买 nike

我想从 TabBar 中弹出我的 ViewController,它是从那个 ViewController 推送的,用于 My 中的 Logout 功能应用程序,我为此添加了代码,但它只在 tabbar 上弹出。而不是在我的第一个 ViewController 中。

最佳答案

在您的注销按钮操作方法中尝试此代码

AppDelegate *appdelegate = (AppDelegate*)[[UIApplication sharedApplication]delegate];
LoginVC *viewController = [[LoginVC alloc]initWithNibName:@"LoginVC" bundle:nil];
NSArray *array = @[viewController];
[appdelegate.navController setViewControllers:array];
[appdelegate.tabbarController.view removeFromSuperview];
[[appdelegate tabbarController] removeFromParentViewController];
NSLog(@"array - > %@",array);
[appdelegate.window setRootViewController:appdelegate.navController];

关于iphone - 从 UITabBarController 弹出 UIViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16869460/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com