Expand UITableView to show all cells in Stack View?

Viewed 15727

I am having trouble getting my UITableView to appear full height in my Stack View.

My view tree looks as follows:

- View
  - Scroll View
    - Stack View
      - Table View
      - Image View
      - Map View

The table view is dynamically populated with data, which works fine. The issue is that only one row is visible at a time and I have to scroll through the list. What I would like to see happen is for the table view to take as much vertical room as it needs to display all the cells.

I did try adjusting table height as follows, but that just ends up with table that no longer scrolls, though even if it did work I would rather have something more dynamic:

override func viewDidAppear(animated: Bool) {
    super.viewDidAppear(animated)        
    self.detailsTableView.frame.size.height = 200
}

I am suspecting that it is probably an aspect of the 'stack view' that needs adjusting, but I am not sure at this point. Can anyone suggest an appropriate way?

2 Answers
Related