我正在添加自定义按钮并添加操作
CLLocationCoordinate2D target=CLLocationCoordinate2DMake(currentLocation.coordinate.latitude,currentLocation.coordinate.longitude);
[mapView_ animateToLocation:target];
用于将 map 移动到当前位置。sdk中是否有默认按钮?
最佳答案
是的,有一个默认按钮来显示 map 的当前位置。只有当您在 API 中设置 myLocationEnable
时,它才会可见。
来自文档
By default, no location data is shown on the map. You may enable the blue "My Location" dot and compass direction by setting myLocationEnabled on GMSMapView.
mapView_.myLocationEnabled = YES;
Enabling this feature will also provide the user's current location through the myLocation property. This property may not be immediately available - for example, if the user is prompted by iOS to allow access to this data. It will be nil in this case.
NSLog(@"User's location: %@", mapView_.myLocation);
关于ios - GMSMapView sdk中是否有显示当前位置的默认按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26751376/