0
これまではこれを使用しましたが、今は動作していない理由を理解できません。それを行う別の方法はありますか?または私はこれを間違っている?UITableView行が展開していない
相続コード:
func tableView(_ tableView: UITableView, HeightForRowAtIndexPath indexPath: IndexPath) -> CGFloat {
if indexPath.row == selectedRowIndex && thereIsCellTapped {
return 140
}
return 40
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cCell = tableView.dequeueReusableCell(withIdentifier: "cartCell", for: indexPath) as? CartCell
if selectedCellIndexPath != nil && selectedCellIndexPath == indexPath {
selectedCellIndexPath = nil
} else {
selectedCellIndexPath = indexPath
}
tableView.beginUpdates()
tableView.endUpdates()
print("did select")
if selectedCellIndexPath != nil {
// This ensures, that the cell is fully visible once expanded
tableView.scrollToRow(at: indexPath, at: .none, animated: true)
}
}
swift 3では "tableView.reloadRowsAtIndexPaths"がないので、 "tableView.reloadRows(at:[indexPath]、with:auto)"を使用しました。 @ lee5783 – user3462448