I've been working around the tableview and got stuck on the following issue.
As far as I understand, the willDisplayCell
delegate method should allow me to access the current cell design.
My issue is: it does not work properly. That delegate function runs only five times when trying to display 80 cells. Regardless of anything other than this function, writing a line of code in the delegate function makes it work well.
Here is my code:
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if indexPath.row == comment_arr.count - 1 {
print("end")
// (1)self.comment_height.constant = self.comment_table.contentSize.height + 30
}
// (2)self.comment_height.constant = self.comment_table.contentSize.height + 30
}
If the (1) line exists, it doesn't work. But if the (2) line exists, it works well.
How do I get it to work?