update tableView contenSize

   NSIndexPath *messageIndexPath = [NSIndexPath indexPathForRow:afterRowCount-1 inSection:0];
   [self.tableView beginUpdates];
   [self.tableView insertRowsAtIndexPaths:@[messageIndexPath] withRowAnimation:UITableViewRowAnimationNone];

   [self.tableView endUpdates];


  NSLog(@"---------%f---------", self.tableView.contentSize.height);
  self.tableView.contentSize = [self.tableView sizeThatFits:CGSizeMake(CGRectGetWidth(self.tableView.bounds), CGFLOAT_MAX)]; //至关重要
  NSLog(@"--------%f----------", self.tableView.contentSize.height);

原文地址:https://www.cnblogs.com/brucemengbm/p/6791405.html