【发布时间】:2018-07-13 19:55:55
【问题描述】:
我正在尝试使用 NSTableCellView 内的动画更新自动布局约束。约束更新正常,但动画没有发生。
以下代码在tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int)内部执行:
NSAnimationContext.runAnimationGroup({ (context) in
context.allowsImplicitAnimation = true
context.duration = 0.3
cell.progressWidthConstraint.constant = CGFloat(progress)
cell.layoutSubtreeIfNeeded()
})
cell 是我的NSTableCellView,progressWidthConstraint 是单元格内NSView 的宽度限制。
要让动画在NSTableCellView 中工作,我需要做些什么特别的事情吗?
【问题讨论】:
标签: swift nstableview nstablecellview nsanimationcontext