Is there a default button to display the current location in the GMSMapView sdk
I add a custom button and add an action
CLLocationCoordinate2D target=CLLocationCoordinate2DMake(currentLocation.coordinate.latitude,currentLocation.coordinate.longitude);
[mapView_ animateToLocation:target];
to move the map to your current location. Is there a default button in the sdk?
+3
source to share
1 answer
Yes, there is a default button to display the current map location. This will only be visible when installed myLocationEnable
in the API.
From the documentation
By default, the map does not display location data. You can enable My Location blue dot and compass heading by setting myLocationEnabled in the GMSMapView.
mapView_.myLocationEnabled = YES;
Enabling this feature will also provide the user's current location via 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. In this case, it will be zero.
NSLog(@"User location: %@", mapView_.myLocation);
+4
source to share