gpt4 book ai didi

ios - UITableView 动画无法正常工作

转载 作者:行者123 更新时间:2023-11-28 06:48:24 28 4
gpt4 key购买 nike

table.beginUpdates()
array.removeLast()
table.deleteRowsAtIndexPaths([anIndexPath], withRowAnimation: UITableViewRowAnimation.None)
for object in container {
array.append(object)
}
array.append("New Object")
table.insertRowsAtIndexPaths([Set of IndexPaths]), withRowAnimation: UITableViewRowAnimation.Fade)
table.endUpdates()

我正在使用上面的代码。它工作正常,但唯一的问题是动画。执行以上代码行后, TableView 滚动位置设置为顶部。不确定如何。欢迎提出想法。

最佳答案

我在设置这个属性之前遇到了这个问题:self.tableView.estimatedRowHeight

如果您正在使用它,请尝试在您的 Controller 上添加此方法以防止出现这种情况。

func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}

希望对你有帮助

关于ios - UITableView 动画无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35600014/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com