iPhone指南针显示到特定位置

iPhone指南针显示到特定位置,第1张

概述我是 Objective-c的新手,所以如果我的问题太垃圾,我想道歉. 我正在编程指南针然而,它正在工作(感谢教程). 给出实际位置(经度和纬度). 罗盘内的箭头是否可以显示指向特定位置(经度2和纬度2)的方向? 我已经读过,我必须考虑iphone的磁性和真实标题. - (void)locationManager:(CLLocationManager *)manager didUpdateHead 我是 Objective-c的新手,所以如果我的问题太垃圾,我想道歉.

我正在编程指南针然而,它正在工作(感谢教程).
给出实际位置(经度和纬度).
罗盘内的箭头是否可以显示指向特定位置(经度2和纬度2)的方向?
我已经读过,我必须考虑iphone的磁性和真实标题.

解决方法
- (voID)locationManager:(CLLocationManager *)manager dIDUpdateheading:(CLheading *)newheading {    double heading = newheading.trueheading; //in degree relative to true north    double bearing = ... //get current bearing in degree relative to true north                         //with the Js library mentioned below it would be something like                         //bearing = userLoc.bearingTo(destionation);    //just two lines,the the sake of the example    double rotationInDegree = (bearing - heading);  //the important line    rotationInDegree = fmod((rotationInDegree + 360),360);  //just to be on the safe sIDe :-)    compassVIEwPerhapsAsImage.transform=CGAffinetransformMakeRotation(degreesToradians(rotationInDegree));}@H_404_19@  

计算轴承的良好链接:

> http://www.movable-type.co.uk/scripts/latlong.html有eplanations和JavaScript exampless,但很容易转换! 总结

以上是内存溢出为你收集整理的iPhone指南针显示到特定位置全部内容,希望文章能够帮你解决iPhone指南针显示到特定位置所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1007388.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存