The alternative way is to use self-sizing cells. You won’t have to calculate (or cache) any row heights.
- Add Auto Layout constraints to your tableViewCell’s subviews which will cause the cell to adjust its height based on the subview’s contents.
- Enable row height estimation.
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 44.0;
For more information, see the detailed walkthrough by smileyborg in his answer to Using Auto Layout in UITableView for dynamic cell layouts & variable row heights.
solved _fetchedResultsController objectAtIndexPath:indexPath freezes app