是否有显示当前位置在GMSMapView中SDK

问题描述:

我增加了自定义按钮,添加在SDK中的地图移动到当前location.Is有一个默认的按钮的动作是否有显示当前位置在GMSMapView中SDK

CLLocationCoordinate2D target=CLLocationCoordinate2DMake(currentLocation.coordinate.latitude,currentLocation.coordinate.longitude); 
    [mapView_ animateToLocation:target]; 

一个默认按钮?

是的,有一个默认按钮来显示当前的地图位置。只有在API中设置myLocationEnable时才会显示。

从文档

Google Map SDK for iOS

缺省情况下,没有位置数据被示出在地图上。您可以通过在GMSMapView上设置myLocationEnabled来启用蓝色的“我的位置”点和指南针方向。

mapView_.myLocationEnabled = YES; 

启用此功能也将通过myLocation财产提供用户的当前位置。该属性可能不会立即可用 - 例如,如果iOS提示用户允许访问此数据。在这种情况下它将是零。

NSLog(@"User's location: %@", mapView_.myLocation); 
+6

可能也需要这样做: mapView.settings.myLocationButton =真 – Cymric 2015-05-06 10:23:01