我需要使用 CA BASIC ANIMATION 同时旋转和移动相同的图像,在 iphone sdk 中有没有办法解决这个问题
任何帮助将不胜感激
这是我的代码
imgview = (UIImageView *)[self.view viewWithTag:imagenumber];
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"position"];
anim.fromValue = [NSValue valueWithCGPoint:CGPointMake(160 + x_movefrom, 240 + y_movefrom)];
anim.toValue = [NSValue valueWithCGPoint:CGPointMake(160 + x_moveto, 240 + y_moveto)];
anim.duration = 2;
anim.removedOnCompletion = YES;
//imgview = (UIImageView *)[self.view viewWithTag:imagenumber];
CABasicAnimation *opacityAnim = [CABasicAnimation animationWithKeyPath:@"alpha"];
opacityAnim.fromValue = [NSNumber numberWithFloat:1.0];
opacityAnim.toValue = [NSNumber numberWithFloat:0.0];
opacityAnim.removedOnCompletion = NO;
CAAnimationGroup *animGroup = [CAAnimationGroup animation];
animGroup.animations = [NSArray arrayWithObjects:opacityAnim,anim, nil];
animGroup.duration = 2;
animGroup.delegate = self;
animGroup.removedOnCompletion = NO;
[imgview.layer addAnimation:animGroup forKey:nil];