如果tableView返回多个section,每个section中只有1个row,则在[_diaryTableView reloadData]后,加上
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:_contents.count - 1];
if (indexPath.section < [self numberOfSectionsInTableView:_diaryTableView]) {
[_diaryTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
}
如果tableView返回1个section,每个section中有多个row,则在[ _diaryTableViewreloadData]后,加上
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:_contents.count - 1 inSection:0];
if (indexPath.row < [_diaryTableView numberOfRowsInSection:0]) {
[_diaryTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
}