How to calculate the car speed on iPhone [closed]
开发者_JAVA技巧
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this questionI want to show a car's speeds on iPhone in real time. What can I use?
Wouldn't using gps to calculate the car's speed take many seconds?
I have an app called Speedometer and Map. I use Core Location to figure out where the user is, how far they move every second in miles, and then I convert this number to hours, and update it constantly.
If you implement a class that conforms to the CLLocationManagerDelegate
protocol, and set an instance of it as the delegate
of a CLLocationManager
object, your object will receive -locationManager:didUpdateToLocation:fromLocation:
messages after you call -[CLLocationManager startUpdatingLocation]
. The CLLocation
object you receive via that method has a speed
property, which is the speed of the device in meters per second. The frequency of updates can be controlled via CLLocationManager
's distanceFilter
and desiredAccuracy
properties.
精彩评论