With this code I set automatic dimension of a cell based on the number of items in array. It works, but when I add some new item with another viewController and then return to this the height does'n update even if the number of array get increased.
I get the array in viewDidAppear
can someone help me?
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
print("called")
let misure = self.array.count
let cellHeight = CGFloat(50.0 * Float(misure))
print(cellHeight)
print(misure, " misure")
let section = indexPath.section
let row = indexPath.row
if section == 3 && row == 0{
return 100.0
}else if section == 4 && row == 0{
return cellHeight + 60.0
}
return 44.0
}
in viewDidLoad I have set
tableView.estimatedRowHeight = 44