![](/img/trans.png)
[英]RxSwift TableView - How to set numberOfRowsInSection?
[英]How to use tableView's datasource (numberOfRowsInSection) wirh RxSwift?
我正在為我的應用程序使用RxSwift、RxCocoa並實現了一個 tableView。
當它從 tableView 的 viewModel 獲取 priceData 時,它顯示了 priceData 的完整列表。
但我想在第一次只顯示 50 個計數,並在滾動時顯示更多。
在沒有 RxSwift/RxCocoa 的情況下,我使用 numberOfRowsInSection 對tableView進行分頁。
但我不知道如何在 RxSwift 中使用它
這是我的代碼。 我應該如何處理我的代碼來制作可分頁的 tableView?
viewModel.priceData
.drive(tableView.rx.items(cellIdentifier: "Cell")) { (index: Int, list, cell: Cell) in
...
}.disposed(by: disposeBag)
RxDataSources
庫允許您對數據進行分段。 將其添加到您的項目中,您就可以使用部分了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.