简体   繁体   English

移动图层上的iOS CALayer.mask

[英]iOS CALayer.mask on a moving layer

I'm writing an iOS app and I have set up some code for a CALayer named "Wheel" to animate (rotate) continuously which works great. 我正在编写一个iOS应用程序,并且为名为“ Wheel”的CALayer设置了一些代码,以使其连续进行动画(旋转),效果很好。 I wish to mask this layer so only a small portion of it is visible, instead of the whole layer. 我希望遮盖此层,以便仅看到一小部分而不是整个图层。

I added a mask using CALayer.mask but it too rotates as it's a sublayer of "Wheel". 我使用CALayer.mask添加了一个蒙版,但由于它是“车轮”的子层,它也会旋转。 Is there any way I can mask the "Wheel" layer so it does what I expect, that is, only show a portion of this layer? 有什么办法可以掩盖“车轮”层,以便它按我的期望进行操作,即仅显示该层的一部分?

Thanks, Regards, 感谢和问候,

Jason 杰森

Can you just drop another layer in on top of it? 您可以在上面再放一层吗? In other words, add another layer to the wheel's superview, which will partially obscure the wheel? 换句话说,在车轮的概览中添加另一层,这会部分遮挡车轮吗? In that case you don't need to use CALayer.mask. 在这种情况下,您无需使用CALayer.mask。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM