Autolayout is ignored in Custom UITableViewCell Autolayout is ignored in Custom UITableViewCell swift swift

Autolayout is ignored in Custom UITableViewCell


Auto-layout was ignored because both the prototype cell AND the UIView of the cell had been given the custom cell class in IB.

Setting the UIView back to UIView class solved the problem.

just to be über clear


I think the problem is that you are implementing :

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return x}

You need to remove this function inorder for the tableview to calculate its automatic height for cells.