ios - 显示 Tableview 的最后一个单元格
问题描述
加载数据后,我想显示 Tableview 的底部单元格我不想每次都滚动到 Tableview 的底部以查看结果
我在 viewDidLoad 中尝试过这个功能,但它在顶部单元格的页面加载不起作用
if myArray.count > 0 {
tableView.scrollToRow(at: IndexPath(item:myArray.count - 1 , section: 0), at: .bottom, animated: false)
}
解决方案
您可以利用scrollView的setContentOffset:animated:
方法
这个答案应该可以帮助你:How to show last add cell on UITableview whileloading view or reloading tableview?
推荐阅读
- c# - 如何将字符串传递给 .NET 辅助服务?
- python - matplotlib - python:只更新多个图中的一个图
- twitter-bootstrap - 引导模式在我的 vue 应用程序上不起作用
- scheme - 以下如何减少?
- laravel - 如何使用 Yajra Laravel 数据表搜索特定列
- python - 我可以确定从子模型实例到它在 flask-sqlalchemy 中属于哪个父代吗?
- r - R:复制样本的向量,而不仅仅是一个样本
- java - 使用来自 jar 外部源的模板
- vue.js - Animejs 3.2.1:Anime stagger 不适用于 vue transition-group
- css - 我添加了一个带有文本“阅读更多”的锚标记,但样式有一些错误