1
好日子,更改视图
这是我的代码:
@IBAction func logOutAction(sender: AnyObject) {
try! FIRAuth.auth()!.signOut()
let alertController = UIAlertController(title: "Sure?", message: "Are you sure you want to log out?", preferredStyle: .Alert)
let defaultAction = UIAlertAction(title: "Yes", style: .Default, handler: nil)
alertController.addAction(defaultAction)
let defaultAction2 = UIAlertAction(title: "No", style: .Cancel, handler: nil)
alertController.addAction(defaultAction2)
self.presentViewController(alertController, animated: true, completion: nil)
let VC = self.storyboard?.instantiateViewControllerWithIdentifier("loginscreen") as! ViewController //The file that controls the view
self.presentViewController(VC, animated: true, completion: nil)
}
正如你可以看到我想要按下注销按钮时注销用户。当用户点击注销UIalert弹出窗口询问他们是否确定要注销时,但是当我点击好的时候,它不会切换回loginscree ViewController。
任何人都可以帮助我吗?
http://imgur.com/a/1mKQp我得到这个错误。我究竟做错了什么? – matthewdossantos
对不起,我的代码中存在拼写错误。我已经更新了 – fiks
谢谢!完美的作品。在2分钟内接受你的答案。 – matthewdossantos