升級(jí)iOS11之后,真機(jī)調(diào)試時(shí)發(fā)現(xiàn)
[self.tableView scrollToBottomAnimated:YES];
上述方法無法實(shí)現(xiàn)滾動(dòng)到tableview的最底部。往往距離最后一個(gè)cell還有一定的距離。
于是改用下面這段代碼
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:self.dataSource.count - 1 inSection:0];
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
完美實(shí)現(xiàn)。