Kri*_*off 1 uitableview ios swift
有什么方法我只能重新加载tableViewCell但不要让它重新加载tableView部分标题视图?当我切换UITableViewCell时,我想更新数据重载更改
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
switch self[selectedIndex] {
case .tracks:
let cell = tableView.dequeueReusableCell(withIdentifier: cellId, for: indexPath) as! TracksCell
return cell
case .playlists:
let cell = tableView.dequeueReusableCell(withIdentifier: cellPlayListId, for: indexPath) as! PlaylistCell
return cell
}
Run Code Online (Sandbox Code Playgroud)
我想要做的只是重新加载UITableViewCell我不想在下面重新加载此代码
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {}
Run Code Online (Sandbox Code Playgroud)
如果我使用tableView.reload()它将在viewForHeaderInSection中影响我的样式因为我添加了UIViewScroll
谢谢您的帮助!
小智 6
如果您只想重新加载特定的tableView单元格,请使用以下命令:
tableView.reloadRows(at: [IndexPath(row: rowNumber, section: 0)], with: .automatic)
Run Code Online (Sandbox Code Playgroud)
它只重新加载单元格而不是部分.