11
for 루프를 사용하여 동적으로 3 개의보기를 만들었습니다. 점에서 나는 터치에 아래의 코딩 방법을 시작하려 ... 내가 연락을 회전 애니메이션을 중지 할 수있는 방법을iPhone에서 UIView CABasicAnimation을 중지하는 방법
- (void)runRightSpinAnimationOnView:(UIView*)view duration:(CGFloat)duration rotations: (CGFloat)rotations repeat:(float)repeat;
{
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
rotationAnimation.fromValue = [NSNumber numberWithFloat:0];
rotationAnimation.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)];
//rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 /* full rotation*/ * rotations * duration ];
rotationAnimation.duration = duration;
//rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = repeat;
[view.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
}
은?보기의 시작 회전 애니메이션 아래의 방법이라고하지만
를 작동하지 않았다-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
int viewTag=[touch view].tag;
UIView *myView =(UIView *)[self.view viewWithTag:viewTag];
[myView.layer removeAllAnimations];
}
좀 도와주세요 ...
의 중복 가능성 (http://stackoverflow.com/questions/2306870/is-there :
당신은 yourView에서 애니메이션을 제거하려면이 옵션을 사용할 수 있습니다 -a-way-to-pause-a-cabasicanimation) – Pfitz