I have many customCells each cell may have a button which acts like a textbox or textArea.When the View loads they have very less height.
override func viewDidLoad() {
super.viewDidLoad();
self.view.backgroundColor = UIColor.groupTableViewBackground
self.tableView.separatorStyle = UITableViewCellSeparatorStyle.none
self.tableView.estimatedRowHeight = 100
tableView.rowHeight = UITableViewAutomaticDimension
self.tableView.setNeedsLayout()
self.tableView.layoutIfNeeded()
}
And i have the following constraints defined on the cell
Will auto layout work with prototype cells at all? If not how to implement this? I tried with HeightforrowAtIndexPath method layout looks good only after scroll. Initial load of the view will not come with good layout.
below is my code for this.
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if (eleData.elementType=="apple")
{
return 90;
}
else if (eleData.elementType=="banana")
{
return 50;
}
else
{
return 30;
}
}
Any suggestions . Thank you in advance.