UITableView没有正确地滚动到底部,直到点击一个单元格
问题描述:
我有一个UITable视图,其顶部有一个视图,然后是它下面的一些单元格。 这种层次的UITableView没有正确地滚动到底部,直到点击一个单元格
<tableview>
<view></view>
<cell></cell>
<cell></cell>
<cell></cell>
</tableview>
现在让他们扩大根据标签的高度,我有我的电池作为动力高度,现在这个有一行标签时工作正常,但是当我在标签设置为0 (多线)我的tableview反弹到顶部时,试图滚动,但是当你这一点,春联作为它的意思后,点击这些细胞之一,在底部细胞
进出口比较新为了迅速,请记住这个答案
在此先感谢
这是代码用于填充细胞
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
myTableView.estimatedRowHeight = 50
myTableView.rowHeight = UITableViewAutomaticDimension
let cell = Bundle.main.loadNibNamed("ProfilerTableViewCell", owner: self, options: nil)?.first as! ProfilerTableViewCell
cell.cellDescription.text = RatingsDataSet[n].descriptions[indexPath.row]
if RatingsDataSet[n].valuesdata[indexPath.row][0] != "0" {
cell.valueLabel.setTitle(RatingsDataSet[n].valuesdata[indexPath.row][0], for: .normal)
}else{
cell.valueLabel.setTitle("Not Set", for: .normal)
cell.valueLabel.backgroundColor = UIColor.lightGray
}
return(cell)
}
答
这两条线:
myTableView.estimatedRowHeight = 50
myTableView.rowHeight = UITableViewAutomaticDimension
属于在viewDidLoad()
,不是你拥有它们。移动这些可能是你需要做的所有事情来纠正问题。
+0
这就是那个谢谢你! – Ray
你的代码在哪里? –
林不知道你需要什么部分,因为我不知道它出错的地方,我已经添加了填充单元格的代码 – Ray