0

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

Khaled Ald
  • 83
  • 2
  • 11
  • 1
    Possible 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 Answers1

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