i have cell have UITextView , but this TextView have dynamic height and can i edit this text view in run time how to change the height of this cell when TextView is Changed
Asked
Active
Viewed 1,375 times
0
-
1Possible duplication of http://stackoverflow.com/questions/35777477/dynamic-uitableviewcell-content-does-not-expand-cell/35777859#35777859. – Bharat Modi Mar 21 '16 at 08:59
1 Answers
3
You can use auto resizable cells to achieve this task. For use reusable cells , you should set UITextViewConstrain all your vertical constraints are set and correct top to bottom and put this one in viewDidLoad()
tableView.rowHeight = UITableViewAutomaticDimension
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}
override func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}

Mudith Chathuranga Silva
- 7,253
- 2
- 50
- 58
-
but in run time the height of the cell in dont change when i add text in textview or delete text i want to change the height of this cell in run time – Khaled Ald Mar 21 '16 at 09:20
-
After you've changed the contenet give tableView.reloadData() – Mudith Chathuranga Silva Mar 21 '16 at 09:21