iosswiftuitableviewheightforrowatindexpath

Set row height for only one tableView and ignore other tableView's in heightForRowAtIndexPath?


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 {

    }
}

Solution

  • Self-sizing would be the preferred way to go, as it works well in conjunction with Dynamic Type and Adaptive UI.