Reputation: 339
I have written an Augmented reality app for iOS which uses location services and GPS, everything works fine when the device is in landscape left but when the devices rotation is landscape right the center azimuth does not get calculated correctly, I am currently calculating this using the true heading in the didUpdateHeading method the subtracting a heading adjustment of 90 degrees. Should I be checking if < 0??
Thanks.
Upvotes: 2
Views: 779
Reputation: 3251
This is a pretty annoying issue and it seems that setting the headingOrientation
property doesn't actually do anything.
The code below works for a landscape left orientation (home button on the right):
orientation = (float) manager.heading.magneticHeading;
orientation += 90.0f;
if(orientation > 360.0f)
orientation -= 360.0f;
So for a landscape right orientation, this should do the trick:
orientation = (float) manager.heading.magneticHeading;
orientation -= 90.0f;
if(orientation < 0.0f)
orientation += 360.0f;
Upvotes: 2