想要识别
UIGestureRecognizer
本身的 touchesBegan、touchesMoved、touchesEnded、touchesEnded。
需要自定义
UIGestureRecognizer
的同时,
导入import UIKit.UIGestureRecognizerSubclass
就可以了。
import UIKit
import UIKit.UIGestureRecognizerSubclass
class GestureRecognizer: UIGestureRecognizer {
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent) {
<#code#>
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent) {
<#code#>
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent) {
<#code#>
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent) {
<#code#>
}
}