8

Hi i am looking to be pointed in the right direction in solving a problem that when the orientation of the iphone is changing/changes what transformations will need to be performed on didUpdateHeading:newHeading to make the value of CLHeading.trueHeading rotate to always act as if the phone was in the orientation of CLDeviceOrientationLandscapeRight.

Thanks

chicken
  • 1,618
  • 5
  • 24
  • 35
  • see this post - http://stackoverflow.com/questions/9260033/north-calculation-based-on-magnetometer-and-gyroscope – ratana May 05 '15 at 00:38

1 Answers1

0

I looked at the apple documentation. The true heading is a compass heading that's corrected for the difference between magnetic north and true north. On a printed map, this is referred to as the declination, and is comes about because the true north pole and the magnetic north pole are not in the same place. The magnetic pole is drifting around slowly, but the tilt of the earth's axis is changing much more slowly.

A real compass has a line on it that you line up with the needle to get a compass reading. I think your question might be restated as: how do I move that reference line around in the iPhone? Currently it's pointing to the top of the screen in portrait mode. To get it to the top of the screen in landscapeRight (home button on the left), you could try subtracting 90° from the heading. If the result is negative, add 360°. This would affect both the true heading and the magnetic heading, but it should move the reference 'north' to where 'west' was before (90° counterclockwise).

Suz
  • 3,744
  • 3
  • 23
  • 26