如何在ios中使用地址显示谷歌地图?

时间:2015-08-18 06:40:30

标签: ios objective-c xcode google-maps

我正在使用Google Maps iOS API在我的应用中显示谷歌地图。我可以通过提供longitude&来显示地图。 latitude的地方。我正在使用以下代码来显示谷歌地图。

 GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
                                                            longitude:151.20
                                                                 zoom:6];
    mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
    mapView_.myLocationEnabled = YES;
    self.view = mapView_;

    // Creates a marker in the center of the map.
    GMSMarker *marker = [[GMSMarker alloc] init];
    marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
    marker.title = @"Sydney";
    marker.snippet = @"Australia";
    marker.map = mapView_;

现在我想显示自定义地址的地图。请告诉我该怎么做?

2 个答案:

答案 0 :(得分:1)

请参阅以下链接,在您的代码中实现并尝试使用它。它可能有助于解决您的问题。

https://developers.google.com/maps/documentation/geocoding/intro

答案 1 :(得分:0)

你必须使用"反向地理编码"。

  

术语地理编码通常是指将人类可读地址转换为地图上的位置。相反的过程,将地图上的位置转换为人类可读的地址,称为反向地理编码。

您需要做的就是发送lat和long并获取可读地址。

https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&key=API_KEY

有关"反向地理编码"的更多信息阅读here