【发布时间】:2017-11-27 12:58:45
【问题描述】:
在我的用户从我的应用程序中注销后,必须显示登录屏幕以允许再次登录。
用户可能会改变,所以我将不得不再次展示主屏幕。上面有一个和我一样工作的代码:
// MainScreenViewController.swift
func onLogoutButtonTouch(_ sender: AnyObject) {
mainViewController.present(loginViewController, animated: true, completion: {completed in
mainViewController.dismiss(animated: true, completion: nil)
})
}
// LoginViewController.swift
func onLoginSuccess() {
loginViewController.present(mainViewController, animated: true, completion: nil)
}
问题
重新登录后显示我的主屏幕后,mainViewController 的最后状态似乎没有改变,还有其他用户的数据,我不希望这样。 p>
有没有办法完全重置 mainViewController 的状态以避免显示上次登录信息?
【问题讨论】:
标签: ios swift swift3 uiviewcontroller uitabbarcontroller