0
有没有什么办法,我可以重新加载只有tableViewCell,但不要重新加载tableView节标题视图?当我切换的UITableViewCell我想更新数据重装变化如何仅在swift中重载tableViewCell?
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
}
我想要做的就是重新加载的UITableViewCell只是我不想,如果我使用的tableView重装下面
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {}
此代码。重载()它会影响我的风格viewForHeaderInSection因为我已经添加UIViewScroll
谢谢你的帮助!
什么是rowNumber? – Kristoff
@Kristoff声明是func reloadRows(在indexPaths:[IndexPath]中,其中animation:UITableViewRowAnimation),其中indexPath是标识要重新加载的行的NSIndexPath对象数组。 – user3441734
@Kristof rowNumber表示您想要重新加载哪个单元格的数量。如果你想重新加载单元格号码2,那么你写的就像。 tableView.reloadRows(at:[IndexPath(row:2,section:0)],with:.automatic) –