您的位置:首页 > 产品设计 > UI/UE

IOS的UITableView显示最底部的cell

2014-12-04 15:50 330 查看
如果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];
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: