touchesBegan 有时不被调用

touchesBegan not being called sometimes

我在初始登录 ViewController 中有 touchesBegan 关闭键盘并取消自定义 AlertView。虽然它最初有效,但在我使用 performSegueWithIdentifier 注销后,touchesBegan 没有被调用。

//to resign keyboard
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
        println("touchesBegan");
        self.view.endEditing(true)
       loginAlert.hideView()
       signupAlert.hideView()
}

//Logout
self.performSegueWithIdentifier("gotoLoginSegue", sender: self);

问题是因为我同时使用了 UITapGestureRecognizertouchesBegan。我在 UITapGestureRecognizer 中处理了场景并删除了 touchesBegan 逻辑并修复了