I want to use animation for image, start on button clicked and stop after 5 seconds.I use this code.
-(IBAction) btnClicked
{
CABasicAnimation *fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
fullRotation.fromValue = [NSNumber numberWithFloat:0];
fullRotation.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)];
fullRotation.duration = 6;
fullRotation.repeatCount = 1e100f;
fullRotation.delegate = self;
[imgView.layer addAnimation:fullRotation forKey:@"360"];
[imgView.layer setSpeed:3.0];
}
with this code animation is started but i don't know how to stop this animation after 5 seconds.