I'm working on an iOS App right now and I want to build a view controller that uses a UITableView to create new events in a calendar (very similarly to how iOS handles event creation in the system calendar, actually). The table view has two sections, the first section holding a date picker and the second section holding two custom cells for entering an event name and notes via a text field and a text view. After playing around with them I managed to force-set them to the right size, but in the process I realized that I don't *actually* understand how iOS calculates individual cell heights, especially in a table view with multiple sections and multiple custom cell classes. So far, I've found a number of things that seem to play a role:

* Contents of a cell, e.g. a text field and its constraints
* Hugging priority and compression resistance priority of a cells content
* Settings for row height and view height in the size inspector of the cell itself:

[![enter image description here](https://i.stack.imgur.com/NnYs8.png)](https://i.stack.imgur.com/NnYs8.png)

* Arrangement and Autolayout settings in the size inspector of the cell
* Settings for the `rowHeight` and `estimatedRowHeight` properties of a UITableViewController

The more I look into it, the more complex and confusing it all gets. Maybe one of you can shed some light on this shady bit of Swift magic?