在我的应用程序,我根据设备的航向旋转的MapView,我只有一个注释,我旋转它的脚,它的pinView了。 我的旋转方法是下一个功能内
- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading {
if (newHeading.headingAccuracy < 0)
return;
CLLocationDirection theHeading = ((newHeading.trueHeading > 0) ?
newHeading.trueHeading : newHeading.magneticHeading);
lastHeading = theHeading;
[self rotateImage:self.mapView duration:0.1 degrees:-theHeading];
[self rotateImage:jerusalemPinView duration:0.1 degrees:theHeading];
}
旋转功能:
- (void)rotateImage:(UIView *)view duration:(NSTimeInterval)duration
degrees:(double)angleDegrees
{
// Setup the animation
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:duration];
[UIView setAnimationBeginsFromCurrentState:YES];
// The transform matrix
CGAffineTransform transform =
CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(angleDegrees));
view.transform = transform;
[UIView commitAnimations];
}
它的工作,但随后的注释和pinView总是“力图把回到北方”接下来的时间,那么当设备被转头我的方法作品等..我失去了什么?
谢谢