首页 > 移动平台 > 详细

IOS的UITableView显示最底部的cell

时间:2014-12-04 18:07:32      阅读:371      评论:0      收藏:0      [点我收藏+]

如果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];
    }




IOS的UITableView显示最底部的cell

原文:http://blog.csdn.net/fanxiaoxuan1234/article/details/41725465

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!