我RxDataSources
用来加载和显示一个UITableview
. 我正在尝试使用它所包含的项目数量来更新节标题,但无论单元格和项目如何正确更新,标题仍然过时。
这是我的DataSource
对象代码:
tableViewDataSource = RxTableViewSectionedAnimatedDataSource<TableViewParticipationSection>(
configureCell: { (_, tableView, _, item) in
return TableViewCellType.transformData(item).cell(inTableView: tableView)
}, titleForHeaderInSection: { dataSource, index in
let sectionModel = dataSource.sectionModels[index]
return "\(sectionModel.items.count)"
})
部分标题的标识只是{return 0}
因为我只有一个部分。
此外,我已经确认,如果我使用此代码:
DispatchQueue.main.asyncAfter(deadline: .now()+3, execute: {
self?.contentView.tableView.reloadData()
})
它实际上会更新部分标题,所以它似乎是一些陈旧的问题,但我似乎无法追踪它。
有没有人有使用动态标题的经验RxDataSources
编辑:经过进一步的实验,标题会更新,如果我在表格视图中滚动,标题会在某个时候发生变化。