New in iOS 8, you can get 100% dynamic table table cells by simply setting the approximate row height, and then place your items in the cell using the automatic layout. If the content increases in height, the cell will also increase in height. This is very useful, and I wonder if it is possible to do the same feat for section headings in a table form?
You can create, for example, a UIView in tableView:viewForHeaderInSection: add UILabel subtext, set layout restrictions for the label for the view, and increase the height of the view to fit the contents of the label, without having to execute tableView:heightForHeaderInSection: :?
The documentation for viewForHeaderInSection states: "This method only works correctly when tableView: heightForHeaderInSection: is also implemented." I have not heard if something has changed for iOS 8.
If you cannot do this, what is the best way to simulate this behavior?
ios uitableview autolayout ios8
Jordan H Apr 05 '15 at 21:17 2015-04-05 21:17
source share