rx.controlEvent(.editingChanged)

2022-05-24  本文已影响0人  BabyNeedCare

使用rx.controlEvent(.editingChanged)过程中,输入中文, action一直调2次,一定要记得判断textField.markedTextRange == nil

    searchTextField.rx.controlEvent(.editingChanged)
        .subscribeOn(MainScheduler.instance)
        .subscribe(onNext: { [weak self] _ in
           self?.action() 
        })
        .disposed(by: bag)

func action() { }

上一篇下一篇

猜你喜欢

热点阅读