Roh*_*mar 5 tableview ios swift
我想检查如何在使用 DiffableDataSource 时设置 tableview 单元格的高度。这是代码:
func configureDataSource() {
dataSource = MenuItemDataSource(tableView: MenuItemTablevVew, cellProvider: { (tableView, indexPath, menuItem) -> UITableViewCell? in
guard let cell = tableView.dequeueReusableCell(withIdentifier: self.cellIdentifier) as? MenuItemTableCell else { fatalError("Cell not exists")
}
cell.data = menuItem
return cell
})
}
func createSnapshot(menuItems: [MenuItemModel]) {
var snapshot = MenuItemSnapshot()
snapshot.appendSections([.First])
snapshot.appendItems(menuItems)
dataSource.apply(snapshot, animatingDifferences: false)
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1627 次 |
| 最近记录: |