[英]How to change SHAPE of UIImage in iOS
您可以通过层转换来实现。
self.imgView.layer.transform = CATransform3DScale(self.imgView.layer.transform, 1, 1, 1.5)
在这里,您需要使用图层变换的z position
。
请参考CATransform3D了解更多详细信息...
您可以通过transform实现。 但不能缩放-您需要设置透视图,并绕x轴旋转一点视图:
// Take Identity matrix
var perspectiveMatrix = CATransform3DIdentity
// Add perspective.
perspectiveMatrix.m34 = -1.0 / 1000.0
// Rotate by 30 degree
let rotationMatrix = CATransform3DRotate(self.perspectiveMatrix,CGFloat.pi / 6.0, 1, 0, 0)
//Apply transform
view.layer.transform = rotationMatrix
您可以在UIView.animation
块中应用变换以制作平滑动画。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.