0
내가 내 응용 프로그램에서 나침반을 삽입하는 코드가 있습니다 수정IOS : 내 응용 프로그램에서 나침반
- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading{
// Convert Degree to Radian and move the needle
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);
}
가 잘 작동하지만, 때로는 그 나침반 이미지를 일을하고 뻗어 보인다 ... 내가 돈 ' 문제가 뭔지 알아. 도와 주시겠습니까?
나는 시도했지만 "[manager stopUpdatingHeading]"이라고 주석을 달았습니다. 그렇지 않으면 애니메이션이 없습니다. 그러나 그것은 잘 작동하는 것 같습니다. – CrazyDev