ios 缩放 CALayer 内容的大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7784577/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Scale the size of CALayer contents
提问by Registered User
I have a few UIImageViews inside CALayer. How do I scale them all at once? I did try setting CALayer properties like la.contentsGravity = @"kCAGravityResizeAspect";
but the images inside the layer always display the original size.
我在 CALayer 中有一些 UIImageViews。我如何一次缩放它们?我确实尝试设置 CALayer 属性,la.contentsGravity = @"kCAGravityResizeAspect";
但图层内的图像始终显示原始大小。
回答by vikingosegundo
if layer
contains the image, this will scale it to 65%
如果layer
包含图像,这会将其缩放到 65%
layer.transform = CATransform3DMakeScale(.65, .65, 1);