I had a TableViewController with one TableView which had it's rows set dynamically with auto layout.
I've added another TableView to the Controller which is used for a menu. It's row heights need to be set at 65.
The problem is, in heightForRowAtIndexPath. I know how to just return 65 for this tableView menu's rows. But I'm not sure how to let auto layout do it's thing for the other tableView still.
Does anyone know how I can accomplish this?
Here's my code:
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
if tableView is YALContextMenuTableView {
return 65
} else {
}
}
Don't use tableView:heightForRowAtIndexPath:
. Adapt Auto Layout and self-sizing for your menu tableView cell, so its constraints size its height (to 65), or
Continue to use tableView:heightForRowAtIndexPath:
. Return a height of UITableViewAutomaticDimension
for your non-menu tableView cells, which will let the system self-size those cells.
Self-sizing would be the preferred way to go, as it works well in conjunction with Dynamic Type and Adaptive UI.