Display location around current location?
In my map i need to display the locations which 开发者_C百科i am getting from a xml which are currently in a 200 mile radius from my current location. I have never done this thing before can you please suggest a way.
Thanks,
Look into CoreLocation. Particularly, the method distanceFromLocation:
of the CLLocation
class will prove useful to find nearby locations. Use CLLocationManager
to find out the current location.
Since you will most likely retrieve latitudes and longitudes from your XML, CLLocation
s initWithLatitude:longitude:
will be handy to initialize CLLocation
objects that you can later pass to distanceFromLocation:
.
This will be the best site you ever visit http://www.raywenderlich.com/2847/introduction-to-mapkit-on-ios-tutorial
精彩评论