swift - 动画调整大小的单元格下方的单元格以一种奇怪的方式跳跃
问题描述
我正在尝试制作一个可扩展单元格,其高度由其内部的约束定义,称为backHighlightHeight
. 但我得到了这个
我尝试过很多方法,但我认为应该按预期工作的方式是这样的:
didSelectRowAt
:
if let tappedCell = tableView.cellForRow(at: indexPath) as? WorkoutCell {
if let index = self.collapsedIndexPaths.firstIndex(of: indexPath) {
self.collapsedIndexPaths.remove(at: index)
tappedCell.showSets(true)
self.tableView.beginUpdates()
self.tableView.endUpdates()
} else {
self.collapsedIndexPaths.append(indexPath)
tappedCell.showSets(false)
self.tableView.beginUpdates()
self.tableView.endUpdates()
}
}
内部WorkoutCell
:
func showSets(_ show: Bool) {
if show {
backHighlightHeight.constant = 200
} else if !show {
backHighlightHeight.constant = 64
}
}
在调用的单元格方法内部,cellForRow
还有正确设置高度的逻辑。
解决方案
推荐阅读
- excel - 根据花药表上的 vlookup 剥离我们的子字符串
- ios - IOS推送通知声音不来
- scala - Scala 数据框导出到 csv 只创建了一个文件夹
- c# - 出现错误:从输入读取并尝试放入 int 数组时,Invalid Initializer 成员
- python - 删除包含关键字的行
- angular - 为什么 awaiting Promise.resolve(v) 给你 v 而不是 awaiting 给你一个 promise?
- c# - Docker 容器内的 .NET Core 控制台应用程序 - System.Net.Http.CurlHandler.ThrowIfCURLEError(CURLcode 错误)
- keycloak - 具有授权的 Keycloak 自定义 SPI REST 端点
- wordpress - 此图片已热链接
- reactjs - 如何在#ag-grid for React 中执行单元格验证