I am using the MapKit for the iPhone and have it setup to get the user's location and display it on the view. But I need to know which state they're in so I know what data to load 开发者_如何学Goand display to the user. Is there any way to get that sort of info?
Have a look at the CurrentAddress code sample:
It makes use of the MKReverseGeocoder class that provides services for converting your map coordinate (specified as a latitude/longitude pair) into information about that coordinate, such as the country, city, or street. A reverse geocoder object is a single-shot object that works with a network-based map service to look up placemark information for its specified coordinate value. To use placemark information is leverages the MKPlacemark class to store this information.
Ok, so it seems the MKReverseGeocoder can do this, but I've yet to determine how, I'll do some digging.
精彩评论