Search code examples
iphoneioscore-animation

CABasicAnimation much faster on 3G than on 4/4S/ipod4


I'm creating a repeating rotating animation of an image and everything works as expected on ipod4/iphone4/iphone4S. However using the same code on iphone3G rotates the image about 5-times faster. The rotation should take 1s.

CABasicAnimation *fullRotation; 
fullRotation = [CABasicAnimation 
                animationWithKeyPath:@"transform.rotation"]; 
fullRotation.fromValue = [NSNumber numberWithFloat:0]; 
fullRotation.toValue = [NSNumber numberWithFloat:(2*M_PI)]; 
fullRotation.duration = 1.0;
fullRotation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
fullRotation.repeatCount = 999999999; 
// Add the animation group to the layer 
[rotateImageView.layer addAnimation:fullRotation forKey:@"rotateAnimation"]; 

The iphone 3G has iOS4.2.1 and the rest of the devices have 4.3/5.0/5.1. I'm thinking of fixing this by checking for iOS version and if it is <4.3 than just bump the duration to something like 5s - then it looks good on the 3G... unfortunately I'm not sure if this is the correct fix.

Any ideas what is going on there and what's a proper fix ?


Solution

  • The issue turned out to be this: this was a borrowed jailbroken iphone and it had an app called Speed Intensifier installed - this app automatically speeds up view animations. After turning this off, the animations worked as expected.