【问题标题】:How to scroll to bottom of tableview?如何滚动到表格视图的底部?
【发布时间】:2018-08-07 07:29:16
【问题描述】:

我必须滚动到表格视图的底部。在 iOS 10 中它工作正常,在 iOS 11 中它滚动到一半的 tableview 并停止。它没有滚动到 tableview 的底部。

[tableObj scrollRectToVisible:CGRectMake(0, tableObj.contentSize.height - tableObj.frame.size.height,tableObj.frame.size.width, tableObj.frame.size.height) animated:YES];

【问题讨论】:

    标签: uitableview uiscrollview


    【解决方案1】:

    试试这个怎么样。

    let indexPath = IndexPath(row: tableDataList.count - 1, section: 0)
    
    table.scrollToRow(at: indexPath, at: .bottom, animated: true)
    

    【讨论】:

    • 不,它不起作用。不向下滚动到表格视图的末尾
    • NSIndexPath * indexPath = [NSIndexPath indexPathForRow:_dataList.count inSection:0]; [tableObj scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom 动画:YES];
    • 哦,我想我犯了一个错误。我忘记了 tableDataList.count 的负 1。你必须知道为什么需要负 1。
    猜你喜欢
    • 1970-01-01
    • 2021-12-11
    • 1970-01-01
    • 2011-08-31
    • 2014-07-11
    • 2020-08-09
    • 1970-01-01
    • 2016-07-10
    • 1970-01-01
    相关资源
    最近更新 更多