我對UILabel的翻譯正在進行動畫處理。每當您在動畫中點擊標籤時,輕按手勢都沒有響應。點擊手勢動畫UIView無法正常工作
這裏是我的代碼:
label.addGestureRecognizer(tapGesture)
label.userInteractionEnabled = true
label.transform = CGAffineTransformMakeTranslation(0, 0)
UIView.animateWithDuration(12, delay: 0, options: UIViewAnimationOptions.AllowUserInteraction, animations: {() -> Void in
label.transform = CGAffineTransformMakeTranslation(0, 900)
}, completion: nil)
動作代碼:
func setUpRecognizers() {
tapGesture = UITapGestureRecognizer(target: self, action: "onTap:")
}
func onTap(sender : AnyObject) {
print("Tapped")
}
任何想法?謝謝:)
也許這將幫助你http://stackoverflow.com/questions/26210318/tap-gesture-with-uigesturerecognizerstate-not-working – owlswipe
顯示您雙擊手勢初始化代碼。 – sschale
@sschale編輯 – mlevi