简体   繁体   English

如何在 RxSwift 中使用 tableView 的数据源 (numberOfRowsInSection)?

[英]How to use tableView's datasource (numberOfRowsInSection) wirh RxSwift?

I'm using RxSwift, RxCocoa for my app and implemented a tableView.我正在为我的应用程序使用RxSwift、RxCocoa并实现了一个 tableView。
When It got priceData from viewModel for tableView, it showed full list of priceData.当它从 tableView 的 viewModel 获取 priceData 时,它显示了 priceData 的完整列表。

But I want to show only 50 counts at the first time and show more when I scroll it.但我想在第一次只显示 50 个计数,并在滚动时显示更多。
Without RxSwift/RxCocoa, I used numberOfRowsInSection for paging of tableView .在没有 RxSwift/RxCocoa 的情况下,我使用 numberOfRowsInSection 对tableView进行分页

But I don't know how I can use this with RxSwift但我不知道如何在 RxSwift 中使用它

Here is my code.这是我的代码。 what should I do with my code for making to pageable tableView?我应该如何处理我的代码来制作可分页的 tableView?

viewModel.priceData         
            .drive(tableView.rx.items(cellIdentifier: "Cell")) { (index: Int, list, cell: Cell) in
...
}.disposed(by: disposeBag)

The RxDataSources library allows you to section your data. RxDataSources库允许您对数据进行分段。 Add it to your project and you can use sections.将其添加到您的项目中,您就可以使用部分了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 RxSwift TableView - 如何设置 numberOfRowsInSection? - RxSwift TableView - How to set numberOfRowsInSection? 如何使用RxSwift使用dataSource和委托方法 - How to use dataSource and delegate methods with RxSwift 如何使用NSArrays的NSDictionary设置TableView的titleForHeaderInSection和numberOfRowsInSection? - How can I set a TableView's titleForHeaderInSection and numberOfRowsInSection with an NSDictionary of NSArrays? 获取错误不明确地使用tableView(_:numberOfRowsInSection :) - Getting error Ambiguous use of tableView(_:numberOfRowsInSection:) 如何手动调用“tableView numberOfRowsInSection” function - How to manually call “tableView numberOfRowsInSection” function 如何修复TableView numberOfRowsInSection返回nil? - How to fix TableView numberOfRowsInSection returning nil? 将RxSwift与包含texfields的Tableview一起使用可消除dataSource更新上的键盘 - Using RxSwift with Tableview containing texfields dismisses keyboard on dataSource update 使用tableView numberOfRowsInSection时遇到问题 - Trouble using tableView numberOfRowsInSection [tableView numberOfRowsInSection:0始终返回0 - [tableView numberOfRowsInSection:0 always returns 0 在numberOfRowsInSection中调用TableView BeginUpdates - Calling TableView BeginUpdates in numberOfRowsInSection
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM