iPhone指南针根据方向旋转
您好,我希望指出正确的方向来解决以下问题:当 iphone 的方向发生变化/更改时,需要对 didUpdateHeading:newHeading 执行哪些转换,以使 CLHeading.trueHeading 的值旋转为始终充当如果手机的方向为 CLDeviceOrientationLandscapeRight。
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我查看了苹果文档。
真航向是根据磁北和真北之间的差异进行修正的罗盘航向。在印刷地图上,这被称为磁偏角,这是因为真北极和磁北极不在同一位置而产生的。磁极正在缓慢漂移,但地轴倾斜度的变化要慢得多。
真正的指南针上有一条线,您可以将其与针对齐以获得指南针读数。我认为你的问题可以重述为:如何在 iPhone 中移动参考线?目前,它在纵向模式下指向屏幕顶部。要将其显示在landscapeRight(左侧主页按钮)中的屏幕顶部,您可以尝试从标题中减去90°。如果结果为负,则添加 360°。这会影响真实航向和磁航向,但它应该将参考“北”移动到之前“西”的位置(逆时针 90°)。
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).