First of all, I don't specifically know what was your action on UITableViewCell
. So, I assume I do that in UITableViewCell
selection.
The below answer only work on iOS 9 and above
But, for some reason, it failed to do it in iOS 8 until it scroll. So, I will update the answer for iOS 8.
I have seen you have used UITableView
's estimatedRowHeight
and rowHeight
at your project. So,
Please check the following
- Make sure
UITableView
's estimatedRowHeight
and rowHeight
include inside viewDidLoad()
- Make sure your
UILabel
lines set to 0

- Make sure there is no constraints about height for your UILabel and let the constraints be like that :

If there are other component also included, make sure only bottom and top space constraints included or top space to container margin and bottom space to container margin.
- Every time that you want to update the cell, you have to reload tableView no matter what your current situation will be.
So, don't say anything yet before you try this sample project, @Rikh
answer still work. May be you are going in wrong direction. Here's the solution. Please do as I said steps by steps and let me know if that didn't work out. You might need to share your sample project which is causing.

Sample Demo - DynamicCellDemo
UPDATE for iOS 8 : update the following code for iOS 8 users
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if #available(iOS 9, *) {
// do nothing
} else {
tblDynamic.reloadData()
}
}