Can the height of a UITableViewCell be changed without reloading the table view?

后端 未结 1 1430
执念已碎
执念已碎 2021-02-14 03:26

I\'m trying to resize a UITableViewCell without reloading the table view.

My UITableViewCell contains a UITextView so users can input list items that may be several line

相关标签:
1条回答
  • 2021-02-14 03:52

    To resize a table view row, try sending:

    [tableView beginUpdates];
    [tableView endUpdates];
    

    These messages one immediately after the other should do the trick provided you have the correct height returned for that cell in the tableView:heightForRowAtIndexPath: method. The row should animate. You should be able to return the height of your cell using its bounds or just from knowing what you've set the cell height as.

    Obviously "tableView" is the name of your table view.

    0 讨论(0)
提交回复
热议问题