0
我有以下代码来旋转指南针。此代码在iPhone 6和iPhone 5上的iOS 8上均可正常工作。iOS CABasicAnimation animationWithKeyPath:@“transform.rotation”wobble
但是,在iOS 7.1.2上使用iPhone 5S尝试此操作时,图像偏离了Z轴,看起来随着它旋转而摆动/浮动。
正如我所说的,这种情况不会发生在iPhone 5或6,这两者都运行iOS 8
谁能提供任何意见?
float oldRad = -manager.heading.trueHeading * M_PI/180.0f;
float newRad = -newHeading.trueHeading * M_PI/180.0f;
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.rotation"];
theAnimation.fromValue = [NSNumber numberWithFloat:oldRad];
theAnimation.toValue=[NSNumber numberWithFloat:newRad];
theAnimation.duration = 0.5f;
[compassimage.layer addAnimation:theAnimation forKey:@"animateMyRotation"];
compassimage.transform = CGAffineTransformMakeRotation(newRad);