为注销操作导航控制器



这是我的应用程序的导航堆栈。新用户

  • Splash->LoginVIewController->TabBarController(带导航每个选项卡上的控制器(->选项卡(3(ProfileView控制器->用户注销时的单击次数

现有用户(已登录用户(

  • Splash->TabBarController(每个选项卡上都有导航控制器选项卡(->选项卡(3(ProfileViewController->用户在注销时单击

我应该如何创建一个segue以避免内存泄漏?当用户单击注销按钮时。它应该创建一个LoginViewController的新实例,并且应该删除TabbarController的所有分配内存。

您可以创建一个LoginVIewController的新对象,并将其设置为rootViewController。

let story = UIStoryboard(name: "Main", bundle:nil)
let vc = story.instantiateViewController(withIdentifier: "ViewController") as! ViewController
UIApplication.shared.windows.first?.rootViewController = vc
UIApplication.shared.windows.first?.makeKeyAndVisible()

相关内容

最新更新