我如何通过 swift 3 将动画添加到任何 UI by snapkit?
how i can add animation to any UI by snapkit by swift 3?
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
动画化到另一个位置
更新约束后,在动画闭包中对视图调用 layoutIfNeeded()。
UIView.animateWithDuration(0.2, delay: 0, options: [], animations: { () -> Void in
self.view.layoutIfNeeded()
})
希望对您有所帮助。
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
动画化到另一个位置
更新约束后,在动画闭包中对视图调用 layoutIfNeeded()。
UIView.animateWithDuration(0.2, delay: 0, options: [], animations: { () -> Void in
self.view.layoutIfNeeded()
})
希望对您有所帮助。