我目前有一个使用 RxSwift 函数rx.tap
UIButton
来消除UIVIewController
button.rx.tap
.subscribe(onNext: { [weak self] in
self?.navigationController?.dismiss(animated: true, completion: nil)
})
.disposed(by: disposeBag)
如何对ASButtonNode
对象实现相同的函数(来自 AsyncDisplayKit(
我尝试使用以下代码
buttonNode.rx.tap
.subscribe(onNext: { [weak self] in
self?.navigationController?.dismiss(animated: true, completion: nil)
})
.disposed(by: disposeBag)
但是我收到一个错误,说Ambiguous reference to member 'tap'
或者还有其他选择。
ASButtonNode 类不是从 UIButton 继承的,它的子类继承自 ASControlNode: ASDisplayNode : NSObject;
因此,为了支持这种行为,您必须实现从RXSwift到ASButtonNode的类似逻辑,您可以在UIButton的github上找到它:)。