- (void)fadeOutStuff
{
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"opacity"];
anim.delegate = self;
anim.duration = 0.25f;
anim.removedOnCompletion = NO;
anim.fillMode = kCAFillModeForwards;
anim.fromValue = [NSNumber numberWithFloat:1.0f];
anim.fromValue = [NSNumber numberWithFloat:0.0f];
[self.searchList.layer addAnimation:anim forKey:@"animationOpacity"];
}
我有这段代码可以简单地为对象设置动画,动画完成后,图层不可触摸。动画过程是否将图层设置为级别/索引?我仍然可以触摸动画层后面的元素,但不能触摸动画层本身。我错过了一个设置吗?基于此代码,我是否以错误的方式制作动画?