Reputation: 827
I would like to achieve the following:
-> Basically a list of views which have dynamic height (using auto layout and wrapping labels), and I don't want to calculate heights-in-pixels if possible
Upvotes: 0
Views: 260
Reputation: 13127
From what you've said, it sounds like you want all cells to be visible at the same time so that the table doesn't scroll. If that's the case, do you really need to use UITableView
?
It sounds like UIStackView
is what you want, and it will do all the sizing automatically. This would effectively allow you to show a screen full of "cells", all sized correctly, without scrolling.
If you want to try the stack view approach, you can drag one in using Interface Builder. You can then add items to it directly in Interface Builder, or, if you are duplicating the same thing again and again and want to do it in code, then add them using addArrangedSubview()
like this:
stackView.addArrangedSubview(yourView)
Upvotes: 1