美文网首页
UIGestureRecognizer 中的 Touch 手势

UIGestureRecognizer 中的 Touch 手势

作者: 冰霜海胆 | 来源:发表于2017-07-20 22:30 被阅读4次

想要识别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#>
    }
    
}

相关文章

网友评论

      本文标题:UIGestureRecognizer 中的 Touch 手势

      本文链接:https://www.haomeiwen.com/subject/iezjkxtx.html