下午好,UITapGestureRecognizer not working on UIView animated
我嘗試在UIView上實現UITapGestureRecognizer。
我創建了UITapGestureRecognizer並像這樣分配給我的UIView。
let gestureGeneral = UITapGestureRecognizer(target: self, action: #selector (self.toConfigurationGeneral(_:)))
self.mode_view.addGestureRecognizer(gestureGeneral)
這是我的方法toConfigurationGeneral:
func toConfigurationGeneral(_ sender:UITapGestureRecognizer){
let nextViewController = storyBoard.instantiateViewController(withIdentifier: "ConfigurationGeneralViewController") as! ConfigurationGeneralViewController
self.navigationController?.pushViewController(nextViewController, animated: false)
}
此代碼是偉大的工作,但是當我在這的UIView添加動畫,我的方法是不叫。這是我的動畫:
UIView.animate(withDuration: 0.5, delay: 0, options: [.curveEaseIn, .repeat, .autoreverse, .allowUserInteraction, .allowAnimatedContent], animations: {
self.mode_view.alpha = 0
} , completion: nil)
謝謝你的回答。