【发布时间】:2018-03-18 23:22:35
【问题描述】:
我正在尝试将 UIView 在 ios 中按其高度上下移动。下面是我这样做的代码。我发现 UIView 确实在屏幕上上下移动,但不是按预期缓慢移动,而是在没有动画的情况下继续瞬间移动。请问有人可以建议吗?
UIView.animate(withDuration: 300, animations: {
let heightOfViewContainingProgrBar = self.viewContainingProgressBar.frame.height
self.viewContainingProgressBar.topAnchor.constraint(equalTo: self.view.topAnchor, constant: -heightOfViewContainingProgrBar).isActive = true
})
【问题讨论】:
标签: ios swift animation nslayoutconstraint