Good day, fellow iOS developers! I am endeavoring to maneuver a view around the x or y axis using that most inimitable of APIs, CLLocationManager! Have you the foggiest as to whether or not this is within the realm of possibility?
My application executes on the iPad—I must thus make do without the use of a gyroscope. However, when I use these runes:
- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading {
CGFloat heading = -1.0f * M_PI * newHeading.magneticHeading / 180.0f;
myView.transform = CGAffineTransformMakeRotation(headin开发者_高级运维g);
}
My view rotates a full 180 degrees! (or as I prefer to conceive of it, a full pi!).
I've tried using CGPoint, but all efforts were for naught. Thank you in advance for you kind assistance.
Have you tried:
M_PI * newHeading.magneticHeading / (-180.0f);
精彩评论