添加手势
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