I am a swift/xcode newbie, following a book app that demonstrates TableViews with prototype cells using Auto Layout. The book provides completed sample projects, so I have a project to compare to.
The table view cells use images of different heights. I followed the book exactly, used the same images, etc. But the book project displays TableViewCell rows that dynamically adjust to the height of the images, but my project does not.
// both of the projects contain this line
tableView.estimatedRowHeight = 50
// I added this line to get cell rows to dynamically adjust size
tableView.rowHeight = UITableViewAutomaticDimension
With the magic line of code added, my project works perfectly, just like the book project.
My question is why does the book project display properly without the magic line of UITableViewAutomaticDimension code? Is there an attribute setting somewhere that I might have missed? Is there some other way the table view can know to use automatic dimensions?
I have carefully checked all my constraints (they follow the book), all the attributes and sizes in the inspectors for table views, cells, frames, imageviews, and have scoured the net for possible answers. (Which is how I found out about the automatic dimension code magic.)
Does anyone know where else (other than the magic code line) xcode can be told to use automatic dimensions on cell rows? Any suggestions on where I might look to find out why two apparently identical projects product different cell row height sizing behaviours? Thanks