In my opinion, here is misunderstanding. For resize selected cell I use method below. And when I resize cell with this method, then I dont go to method tableView(cellForRowAt:) already.
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
{
if selectedCellIndexPath == indexPath {
return selectedCellHeight
}
return unselectedCellHeight
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var cell: UITableViewCell? = tableView.dequeueReusableCell(withIdentifier: "sum cell") as UITableViewCell?
if cell == nil {
cell = UITableViewCell(style: UITableViewCellStyle.value1, reuseIdentifier: "sum cell")
}
let label = cell?.contentView.viewWithTag(1) as! UILabel
label.text = String(sums[indexPath.row])
return cell!
}