なんとかするから、なんとかなる

エンジニア関係のことを書きます

iOS UIButtonやUIViewでアニメーション中にタップイベントを検知する

English version below

はじめに

UIViewやUIButtonでアニメーション中にタップイベントを受け取る方法です。

解決方法

UIView.animate関数のオプションに".allowUserIntercation"を追加するだけです。

UIView.animate(withDuration: 1.0, 
    delay: 0,
    options: [.allowUserInteraction],
    animations: {
    self.view.transform = CGAffineTransform(scaleX: 0.5, y: 0.5)
}, completion: nil)    }

参考URL