美文网首页iOS开发
UItableview滚动到底部

UItableview滚动到底部

作者: FengxinLi | 来源:发表于2017-10-26 10:15 被阅读734次

    UItableview滚动到底部分二种情况有tableviewfooter和无tableviewfooter

    1有tableviewfooter

    [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:

    [self.tableView numberOfRowsInSection:0]-1 inSection:0]

    atScrollPosition:UITableViewScrollPositionTop animated:YES];

    2无tableviewfooter

    这个需要判断是否有数据,有才滚动

    if(_dataSourceArray.count > 0){

    NSIndexPath *indexpath = [NSIndexPath indexPathForRow:_dataSourceArray.count-1  inSection:0];

    [_tableView scrollToRowAtIndexPath:indexpath atScrollPosition:UITableViewScrollPositionBottom animated:NO];

    }

    相关文章

      网友评论

        本文标题: UItableview滚动到底部

        本文链接:https://www.haomeiwen.com/subject/ourduxtx.html