I am using xib to display the data but if the data for labels are empty am hiding the labels but height of the cell is not decreasing based on the contents.Thanks in advance your suggestions are helpful
Asked
Active
Viewed 94 times
0
-
Possible duplicate of [Dynamic UITableView row height using UIStackView?](https://stackoverflow.com/questions/36238662/dynamic-uitableview-row-height-using-uistackview) – Sateesh Yemireddi Feb 05 '19 at 10:11
-
1try stackView , or adding a constraint and reduce the constant of them to 0 instead of hiding it – Mohmmad S Feb 05 '19 at 10:11
-
Possible duplicate of [Using Auto Layout in UITableView for dynamic cell layouts & variable row heights](https://stackoverflow.com/questions/18746929/using-auto-layout-in-uitableview-for-dynamic-cell-layouts-variable-row-heights) – vpoltave Feb 05 '19 at 10:42
1 Answers
0
You should use auto layout constarits, not set a fixed height for labels please connect to top and bottom
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}

LeNI
- 1,184
- 2
- 10
- 19