Advertisement
undeadhip

Untitled

Nov 13th, 2015
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
  2.     NSIndexPath *indexPathCopy = [NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section];
  3.     NSString *sizeString = self.heightCache[indexPathCopy];
  4.     if (sizeString) {
  5.         CGSize size = CGSizeFromString(sizeString);
  6.         NSLog(@"estimatedHeightForRowAtIndexPath %f row %ld",size.height, (long)indexPath.row);
  7.         return size.height;
  8.     }
  9.  
  10.     return UITableViewAutomaticDimension;
  11. }
  12.  
  13. - (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
  14.     NSIndexPath *indexPathCopy = [NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section];
  15.     self.heightCache[indexPathCopy] = NSStringFromCGSize(cell.frame.size);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement