如果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]; }
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:_contents.count - 1 inSection:0]; if (indexPath.row < [_diaryTableView numberOfRowsInSection:0]) { [_diaryTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; }