[英]How can I find a city and show it on a MKMapView?
I'm developing an iPhone application to search cities on a MKMapView. 我正在开发一个iPhone应用程序,以在MKMapView上搜索城市。 The user specify a city and then it show its location on a MKMapView. 用户指定城市,然后在MKMapView上显示其位置。 Is that possible? 那可能吗?
Thanks. 谢谢。
EDIT : iOS 5 now includes CLGeocoder , which will do just that for you. 编辑 :iOS 5现在包括CLGeocoder ,它将为您做到这一点。
You could use Google's Geocoder REST API . 您可以使用Google的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 . 由于响应为JSON格式,因此您需要JSON解析器 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.