Mam 3 widoki dynamicznie tworzone przy użyciu pętli for. że zadzwoniłem poniższą metodę animacji obrotuJak zatrzymać UIView CABasicAnimation w telefonie iPhone
- (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"];
}
jak mogę zatrzymać animację obrotu w kontakcie rozpocząć widzenia? ... Próbowałem poniżej kodowanie w kontakcie rozpocząć metody, ale to nie działa
-(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];
}
proszę mi pomóc ...
możliwe duplikat (http://stackoverflow.com/questions/2306870/is-there -a-way-to-pause-a-cabasicanimation) – Pfitz