- (void)viewDidLoad
{
super viewDidLoad];
// Do any additional setup after loading the view.
timer = NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(handleTimer:) userInfo:nil repeats:YES];
CABasicAnimation *anim1 = CABasicAnimation animationWithKeyPath:@"transform"];
anim1.toValue = NSValue valueWithCATransform3D:CATransform3DMakeRotation(3.1415, 1.0, 0, 1.0)];
anim1.duration = 2;
anim1.cumulative = YES;
anim1.repeatCount = 1000;
CABasicAnimation *anim2 = CABasicAnimation animationWithKeyPath:@"transform2"];
anim2.toValue = NSValue valueWithCATransform3D:CATransform3DMakeRotation(3.1415, 0, 1.0, 1.0)];
anim2.duration = 2;
anim2.cumulative = YES;
anim2.repeatCount = 1000;
image1.layer addAnimation:anim1 forKey:@"transformAnimation"];
image2.layer addAnimation:anim2 forKey:@"transform2Animation"];
}
此处我分别对image1和image2添加了不同的动画,为什么只有image1最后显示出我指定的动画效果,而image2完全没有反应啊!(ps:image1和image2都为UIImageView对象)