在使用基于块的动画的选项字段进行动画制作时,允许用户与视图交互非常容易。但是在我的程序中,我使用的是 CAKeyframeAnimation 并且我没有看到任何属性来设置用户交互启用。有没有办法做到这一点?
谢谢,
编辑:这是实际代码:
- (void)move
{
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, NULL, 50, 120);
for (int i = 0; i < 5; i ++)
CGPathAddLineToPoint(path, NULL, arc4random() % 320, arc4random() % 480);
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
[animation setPath:path];
[animation setDuration:10];
CFRelease(path);
[self.layer addAnimation:animation forKey:@"move"];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[self setAlpha:0];
}