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);