如何在 iPhone 上查看汽车速度?
我想在开车时在 iPhone 上查看车速,那么我应该使用什么以及如何操作? 核心运动还是核心位置?有文档或者示例代码吗?
I want to find the car speed on my iPhone when driving so what should I use and how?
Core Motion or Core Location? Is there any documentation or sample code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
嘿 - 你需要核心位置。
这里有一个非常好的教程 - http://www. vellios.com/2010/08/16/core-location-gps-tutorial/ 我关注过一次。有一个完整的系列,但这个系列向您展示如何计算设备的位置和速度。还有一个示例项目可供下载。希望这有帮助!
Hey - You'll want core location for this.
There is a really good tutorial here - http://www.vellios.com/2010/08/16/core-location-gps-tutorial/ that I followed once. There is a whole series but this one shows you how to calculate the position and speed of your device. There is a sample project to download too. Hope this helps!
CoreMotion
不会对您有太大帮助,因为它是设备加速计和陀螺仪的抽象。你可以测量加速度和减速度,并根据基础物理计算速度,但我不会这样做。我会使用
CoreLocation
框架并依赖 GPS 定位。这里有大量的示例代码以及 WWDC10 视频,所以请继续查找。CoreMotion
would not help you much, because it is an abstraction of the device's accelerometer and the gyroscope. You could measure acceleration and deceleration and computing the speed from basic physics, but I would not do so.I would use the
CoreLocation
frameworkd and rely on GPS positioning. There is a ton of sample code out there and a WWDC10 video as well, so go ahead and look it up.在
CLLocation
类中使用CLLocationManager
和speed属性Use
CLLocationManager
and speed property inCLLocation
class