items.bindTo(tableView.rx.items(cellIdentifier: "cellIdentifier", cellType: AttentionTableViewCell.self)){(row,dic,cell) in
cell.configueCell(with: dic)
}.addDisposableTo(dispose)
答案 0 :(得分:4)
也许你只需要更新你的RxSwift库版本。它看起来与UI {Table | Collection}几乎相同。查看rx绑定。 假设您有一个数据源,如:
let items: Observable<[String]> = Observable.of(["Row1", "Row2", "Row3"])
填充UIPickerView:
items.bind(to: yourPickerView.rx.itemTitles) { (row, element) in
return element
}
.disposed(by: disposeBag)
处理所选项目:
yourPickerView.rx.itemSelected
.subscribe { (event) in
switch event {
case .next(let selected):
print("You selected #\(selected.row)")
default:
break
}
}
.disposed(by: disposeBag)
答案 1 :(得分:0)
提供的选择器数据源如下所示:
pickerView.rx.itemSelected.subscribe(onNext: {[weak self](row,component) in
guard let s = self else { return }
s.label.text = s.pickerDataSource[component][row]
}).disposed(by: disposeBag)
你可以用这种方式实现'绑定':
{{1}}
答案 2 :(得分:0)
Swift4示例
419