i have never worked with MKMapView or CoreLocation before so I need some help.
I want to get my current position (maybe show this position in a mapView) and update my position periodically and compare my new and old position every time to see if i have moved.
Is something like this possible? How can I do this? I have already implemented a MKMapView. But I am not sure how I could get my current position and make a comparison to see if i am moving…
Thanks for any help!
This is pretty simple. Set
showsUserLocationtoYESand you’re done. docsTo make it a little nicer you can center the
MKMapViewevery time the position changes. See here how to do it.If you want to know if you have moved, you should store the most recent position in a property and then in the delegate method
mapView:didUpdateUserLocation:check if the new location is different from the last location.I’m actually not sure if the delegate method is only called when the
userLocationhas changed. In that case you don’t have to store the location as a property and do the check, just implement the delegate method and do your stuff there.