【发布时间】:2014-09-26 20:14:45
【问题描述】:
我有以下代码来旋转指南针。此代码在 iPhone 6 和 iPhone 5 上的 iOS 8 上运行良好。
但是,当在装有 iOS 7.1.2 的 iPhone 5S 上尝试此操作时,图像会偏离 Z 轴,在旋转时出现摆动/浮动。
正如我所说,这不会发生在运行 iOS 8 的 iPhone 5 或 6 上。
谁能给点建议?
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);
【问题讨论】:
标签: ios objective-c ios7 uiimageview cabasicanimation