[英]rotate png inside uibutton
Here's an example of how can you do it using Transforms:- The code works with all the elements that inherits from UIView 这是一个如何使用Transforms的示例:-该代码适用于从UIView继承的所有元素
UIView.animate(withDuration: 0.5) {
self.yourButton.imageView?.transform = CGAffineTransform(rotationAngle: CGFloat.pi)
}
To set it back to original position:- 要将其设置回原始位置:-
UIView.animate(withDuration: 0.5) {
self.yourButton.imageView?.transform = .identity)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.