label.snp.makeConstraints { (make) -> Void in
make.width.equalTo(box).dividedBy(2)
make.top.equalTo(100)
make.left.greaterThanOrEqualTo(box.snp.left).offset(15)
}
我想通过 button
将这个 label
动画化到另一个位置
最佳答案
更新约束后,在动画闭包中对 View 调用 layoutIfNeeded()。
UIView.animateWithDuration(0.2, delay: 0, options: [], animations: { () -> Void in
self.view.layoutIfNeeded()
})
希望这对您有所帮助。
关于ios - 我如何通过 swift 3 的 snapkit 向任何 UI 添加动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39637663/