添加手势

let disposeBag = DisposeBag() 
let label = UILabel() 
label.text = "Hello World!" 

let tapGesture = UITapGestureRecognizer() 
label.addGestureRecognizer(tapGesture) 

tapGesture.rx.event.bind(onNext: { recognizer in 
    print("touches: \(recognizer.numberOfTouches)") //or whatever you like 
}).disposed(by: disposeBag)

 

 

 参考

https://www.jianshu.com/p/f61a5a988590

posted on 2020-11-17 10:59  懂事长qingzZ  阅读(248)  评论(0编辑  收藏  举报