以下は私が使用するコードです。アニメーションは機能します。しかし、それはそれの後の元の状態に戻った。私のコードに何か問題はありますか?ありがとう。iphone - アニメーションが元の状態に戻る
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
CABasicAnimation *expand=[CABasicAnimation animationWithKeyPath:@"transform"];
expand.toValue=[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.2, 1.2, 1.0)];
expand.autoreverses=NO;
expand.removedOnCompletion=YES;
CABasicAnimation *opacityAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
opacityAnimation.toValue = [NSNumber numberWithFloat:0.0f];
opacityAnimation.autoreverses=NO;
opacityAnimation.removedOnCompletion=YES;
CAAnimationGroup *group=[CAAnimationGroup animation];
group.animations=[[NSArray alloc] initWithObjects:expand,opacityAnimation, nil];
group.duration=1.0;
group.fillMode=kCAFillModeForwards;
group.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
[view1.layer addAnimation:group forKey:@"expand"];
}
まだ動作しません –