我将登录segue调用到另一个视图控制器(登录视图),我必须在prepareForSegue时将其设置为我的登录视图作为前视图控制器,否则我不知道为什么我的侧边菜单将保持在前视图中,我的登录视图将无法完全显示:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "showSegue" {
self.revealViewController().revealToggleAnimated(false)
let vc = storyboard!.instantiateViewControllerWithIdentifier("LoginViewController")as! LoginViewController
self.revealViewController().setFrontViewController(vc, animated: false)
}
}
用户在登录视图中成功登录后,应该弹出警报视图,通知用户登录成功并返回上一页,并使用unwind segue:
let message = (MCLocalization.sharedInstance.stringForKey("login_success_message", replacements: ["%s" : fullName]))
let alert = UIAlertController(title: (MCLocalization.sharedInstance.stringForKey("login_success_title")), message: message, preferredStyle: UIAlertControllerStyle.Alert)
let OKAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: {
(_)in
self.performSegueWithIdentifier("unwindSideMenu", sender: self)
})
alert.addAction(OKAction)
self.presentViewController(alert, animated: false, completion: nil)
但是,放松它不起作用,它出现了这个错误:
2016-07-20 10:44:47.945 Jocom[9475:501947] Unbalanced calls to begin/end appearance transitions for <Jocom.LoginViewController: 0x7fbad2817630>.
我该如何解决这个问题?