问题描述
我今天遇到一个奇怪的行为:我有一个collectionView,一个结构文件(已实现适当的Hashable协议)。一切都很好...第一次。 当我的模型改变时,我使用与第一次相同的代码触发重新加载:
datasource.apply(snap,animatingDifferences: animatingDifferences,completion: completion)
我确实输入了数据源的z完成块。该单元已出队,我确实输入了configure方法(在此我更改了一些东西)。我的模型也已正确更新。
let dataSource = DataSource(collectionView: collectionView) { [weak self] (collection,indexPath,model) -> UICollectionViewCell? in
guard let cell: VehicleCell = collectionView.automaticallyDequeueReusableCell(forIndexPath: indexPath) else { return nil }
cell.configure(model)
cell.vehicleDelegate = self?.vehicleDelegate
return cell
}
func configure(_ vehicle: Vehicle) {
self.vehicle = vehicle
print("? \(vehicle.model) - \(vehicle.isCurrentVehicle ? "?" : "?")")
}
如果我在configure方法中记录模型,那么我确实有很好的价值...但是单元格从未更新
? Coupé Série 1 - ?
? 207SW - ?
? 207SW - ?
? Coupé Série 1 - ?
? Coupé Série 1 - ?
? 207SW - ?
? Coupé Série 1 - ?
? 207SW - ?
如何才能更新和配置单元,而不能直观地对其进行更新?
谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)