代替按钮点击方法
btn.rx.tap.subscribe(onNext: { [weak self] in
self!.checkBalance()
}).disposed(by: bag)
// 或者
btn.rx.controlEvent(.touchUpInside).subscribe(
onNext: { [weak self] in
self!.checkBalance()
} ).disposed(by: bag)
UIControl 点击方法
view.rx.controlEvent(.touchUpInside).subscribe(
onNext: { [weak self] in
self?.dismiss(animated: false)
}
).disposed(by: bag)
代替手势方法
let view = UIView()
let tap = UITapGestureRecognizer()
view.addGestureRecognizer(tap)
tap.rx.event.subscribe(
onNext: { _ in
}
).disposed(by: bag)
textfiled的代理
textFiled.rx.text.orEmpty.subscribe(onNext: { (text) in
print(text)
}).disposed(by: bag)