在我的应用程序中,我为 UIImageView 添加了一个蒙版,并将其设置为半透明度。此外,还有一个 CAAnimation 在该 CALayer 上运行。
现在,我想在上面添加一个 CATextLayer,它不能受遮罩层的影响。我怎样才能做到这一点?
谢谢
编辑:出现了一个新问题。不知何故,如果在 animationDidStart 中向 CATextLayer 发送消息,动画将以相反的顺序执行。
- (void)viewDidLayoutSubviews {
for (int i=1; i<6; i++) {
NSString* intValue = [NSString stringWithFormat:@"%d", i];
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"path"];
animation.duration = 0.5;
animation.delegate = self;
animation.repeatCount = 0;
animation.autoreverses = NO;
[animation setValue:intValue forKey:@"animationString"];
animation.timingFunction = nil;
[animation setRemovedOnCompletion:NO];
[animation setFillMode:kCAFillModeForwards];
animation.fromValue = (id) [self getCGRectForZoomLevel:i];
animation.toValue = (id) [self getCGRectForZoomLevel:i + 1 ];
animation.beginTime = CACurrentMediaTime() + i * 2;
[self.shapeLayer addAnimation:animation forKey:intwaarde];
}
}