[英]How to create bouncing effect in swift?
You should use UIView.animate with usingSpringWithDamping and initialSpringVelocity parameters.您应该使用 UIView.animate 与 usingSpringWithDamping 和 initialSpringVelocity 参数。 Eg:
例如:
// Change position of view
UIView.animate(withDuration: 1.0, delay: 0.0, usingSpringWithDamping: 1.0, initialSpringVelocity: 0.0, options: [], animations: {
// Call layoutIfNeeded()
})
Or you can change view's position in animation completion block.或者您可以在 animation 完成块中更改视图的 position。 But it's not recommended.
但不建议这样做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.