Though your question is not clear enough but so far I have understood that you want to make a UITableView
which is Group TableView
. If I am not wrong then you want to make every section
as a question container and Row or Cell
will be the answer of that question. In one word you want to make an expandable UITableViewCell
. If so then you can check following link
https://www.appcoda.com/expandable-table-view/
https://medium.com/ios-os-x-development/ios-how-to-build-a-table-view-with-collapsible-sections-96badf3387d0
https://mobikul.com/create-expandable-table-view-swift/
Now your second problem was HeaderText
which is not taking numberOfLines .To solve this problem you can use the delegate method of UITableView
which is func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
where you can add your UILabel
and set your numberOfLines
of the text.
AND func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat
which will contain the height of the UITableView
section header. For making dynamic header you have to calculate the UILabel
height and set it as a section header height.
Feel free to ask any questions.
Happy Coding!!