简体   繁体   中英

How can I find a city and show it on a MKMapView?

I'm developing an iPhone application to search cities on a MKMapView. The user specify a city and then it show its location on a MKMapView. Is that possible?

Thanks.

EDIT : iOS 5 now includes CLGeocoder , which will do just that for you.

You could use Google's Geocoder REST API . A request looks like this:

http://maps.google.com/maps/api/geocode/json?address=city&sensor=true_or_false

Since the response is in JSON format, you'll need a JSON parser .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM