<GMSMapViewDelegate> Protocol Reference

<GMSMapViewDelegate> Protocol Reference

Overview

Delegate for events on GMSMapView.

Public Member Functions

(void) - mapView:willMove:
 Called before the camera on the map changes, either due to a gesture, animation (e.g., by a user tapping on the "My Location" button) or by being updated explicitly via the camera or a zero-length animation on layer.
(void) - mapView:didChangeCameraPosition:
 Called repeatedly during any animations or gestures on the map (or once, if the camera is explicitly set).
(void) - mapView:idleAtCameraPosition:
 Called when the map becomes idle, after any outstanding gestures or animations have completed (or after the camera has been explicitly set).
(void) - mapView:didTapAtCoordinate:
 Called after a tap gesture at a particular coordinate, but only if a marker was not tapped.
(void) - mapView:didLongPressAtCoordinate:
 Called after a long-press gesture at a particular coordinate.
(BOOL) - mapView:didTapMarker:
 Called after a marker has been tapped.
(void) - mapView:didTapInfoWindowOfMarker:
 Called after a marker's info window has been tapped.
(void) - mapView:didLongPressInfoWindowOfMarker:
 Called after a marker's info window has been long pressed.
(void) - mapView:didTapOverlay:
 Called after an overlay has been tapped.
(void) - mapView:didTapPOIWithPlaceID:name:location:
 Called after a POI has been tapped.
(nullable UIView *) - mapView:markerInfoWindow:
 Called when a marker is about to become selected, and provides an optional custom info window to use for that marker if this method returns a UIView.
(nullable UIView *) - mapView:markerInfoContents:
 Called when mapView:markerInfoWindow: returns nil.
(void) - mapView:didCloseInfoWindowOfMarker:
 Called when the marker's info window is closed.
(void) - mapView:didBeginDraggingMarker:
 Called when dragging has been initiated on a marker.
(void) - mapView:didEndDraggingMarker:
 Called after dragging of a marker ended.
(void) - mapView:didDragMarker:
 Called while a marker is dragged.
(BOOL) - didTapMyLocationButtonForMapView:
 Called when the My Location button is tapped.
(void) - mapView:didTapMyLocation:
 Called when the My Location Dot is tapped.
(void) - mapViewDidStartTileRendering:
 Called when tiles have just been requested or labels have just started rendering.
(void) - mapViewDidFinishTileRendering:
 Called when all tiles have been loaded (or failed permanently) and labels have been rendered.
(void) - mapViewSnapshotReady:
 Called when map is stable (tiles loaded, labels rendered, camera idle) and overlay objects have been rendered.
(void) - mapView:didChangeMapCapabilities:
 Called every time map capabilities are changed.
(void) - mapView:didTapFeatures:inFeatureLayer:atLocation:
 Called after features in a data-driven styling feature layer have been tapped.

Member Function Documentation

- (void) mapView: (GMSMapView *)  mapView
willMove: (BOOL)  gesture 
[optional]

Called before the camera on the map changes, either due to a gesture, animation (e.g., by a user tapping on the "My Location" button) or by being updated explicitly via the camera or a zero-length animation on layer.

Parameters:
mapViewThe map view that was tapped.
gestureIf YES, this is occurring due to a user gesture.
- (void) mapView: (GMSMapView *)  mapView
didChangeCameraPosition: (GMSCameraPosition *)  position 
[optional]

Called repeatedly during any animations or gestures on the map (or once, if the camera is explicitly set).

This may not be called for all intermediate camera positions. It is always called for the final position of an animation or gesture.

- (void) mapView: (GMSMapView *)  mapView
idleAtCameraPosition: (GMSCameraPosition *)  position 
[optional]

Called when the map becomes idle, after any outstanding gestures or animations have completed (or after the camera has been explicitly set).

- (void) mapView: (GMSMapView *)  mapView
didTapAtCoordinate: (CLLocationCoordinate2D)  coordinate 
[optional]

Called after a tap gesture at a particular coordinate, but only if a marker was not tapped.

This is called before deselecting any currently selected marker (the implicit action for tapping on the map).

- (void) mapView: (GMSMapView *)  mapView
didLongPressAtCoordinate: (CLLocationCoordinate2D)  coordinate 
[optional]

Called after a long-press gesture at a particular coordinate.

Parameters:
mapViewThe map view that was tapped.
coordinateThe location that was tapped.
- (BOOL) mapView: (GMSMapView *)  mapView
didTapMarker: (GMSMarker *)  marker 
[optional]

Called after a marker has been tapped.

Parameters:
mapViewThe map view that was tapped.
markerThe marker that was tapped.
Returns:
YES if this delegate handled the tap event, which prevents the map from performing its default selection behavior, and NO if the map should continue with its default selection behavior.
- (void) mapView: (GMSMapView *)  mapView
didTapInfoWindowOfMarker: (GMSMarker *)  marker 
[optional]

Called after a marker's info window has been tapped.

- (void) mapView: (GMSMapView *)  mapView
didLongPressInfoWindowOfMarker: (GMSMarker *)  marker 
[optional]

Called after a marker's info window has been long pressed.

- (void) mapView: (GMSMapView *)  mapView
didTapOverlay: (GMSOverlay *)  overlay 
[optional]

Called after an overlay has been tapped.

This method is not called for taps on markers.

Parameters:
mapViewThe map view that was tapped.
overlayThe overlay that was tapped.
- (void) mapView: (GMSMapView *)  mapView
didTapPOIWithPlaceID: (NSString *)  placeID
name: (NSString *)  name
location: (CLLocationCoordinate2D)  location 
[optional]

Called after a POI has been tapped.

Parameters:
mapViewThe map view that was tapped.
placeIDThe placeID of the POI that was tapped.
nameThe name of the POI that was tapped.
locationThe location of the POI that was tapped.
- (nullable UIView *) mapView: (GMSMapView *)  mapView
markerInfoWindow: (GMSMarker *)  marker 
[optional]

Called when a marker is about to become selected, and provides an optional custom info window to use for that marker if this method returns a UIView.

If you change this view after this method is called, those changes will not necessarily be reflected in the rendered version.

The returned UIView must not have bounds greater than 500 points on either dimension. As there is only one info window shown at any time, the returned view may be reused between other info windows.

Removing the marker from the map or changing the map's selected marker during this call results in undefined behavior.

Returns:
The custom info window for the specified marker, or nil for default
- (nullable UIView *) mapView: (GMSMapView *)  mapView
markerInfoContents: (GMSMarker *)  marker 
[optional]

Called when mapView:markerInfoWindow: returns nil.

If this method returns a view, it will be placed within the default info window frame. If this method returns nil, then the default rendering will be used instead.

Parameters:
mapViewThe map view that was pressed.
markerThe marker that was pressed.
Returns:
The custom view to display as contents in the info window, or nil to use the default content rendering instead
- (void) mapView: (GMSMapView *)  mapView
didCloseInfoWindowOfMarker: (GMSMarker *)  marker 
[optional]

Called when the marker's info window is closed.

- (void) mapView: (GMSMapView *)  mapView
didBeginDraggingMarker: (GMSMarker *)  marker 
[optional]

Called when dragging has been initiated on a marker.

- (void) mapView: (GMSMapView *)  mapView
didEndDraggingMarker: (GMSMarker *)  marker 
[optional]

Called after dragging of a marker ended.

- (void) mapView: (GMSMapView *)  mapView
didDragMarker: (GMSMarker *)  marker 
[optional]

Called while a marker is dragged.

- (BOOL) didTapMyLocationButtonForMapView: (GMSMapView *)  mapView [optional]

Called when the My Location button is tapped.

Returns:
YES if the listener has consumed the event (i.e., the default behavior should not occur), NO otherwise (i.e., the default behavior should occur). The default behavior is for the camera to move such that it is centered on the device location.
- (void) mapView: (GMSMapView *)  mapView
didTapMyLocation: (CLLocationCoordinate2D)  location 
[optional]

Called when the My Location Dot is tapped.

Parameters:
mapViewThe map view that was tapped.
locationThe location of the device when the location dot was tapped.
- (void) mapViewDidStartTileRendering: (GMSMapView *)  mapView [optional]

Called when tiles have just been requested or labels have just started rendering.

- (void) mapViewDidFinishTileRendering: (GMSMapView *)  mapView [optional]

Called when all tiles have been loaded (or failed permanently) and labels have been rendered.

- (void) mapViewSnapshotReady: (GMSMapView *)  mapView [optional]

Called when map is stable (tiles loaded, labels rendered, camera idle) and overlay objects have been rendered.

- (void) mapView: (GMSMapView *)  mapView
didChangeMapCapabilities: (GMSMapCapabilityFlags mapCapabilities 
[optional]

Called every time map capabilities are changed.

Parameters:
mapViewThe map view where mapCapabilities was changed.
mapCapabilitiesFlags representing the capabilities on the map currently.
- (void) mapView: (GMSMapView *)  mapView
didTapFeatures: (NSArray< id< GMSFeature >> *)  features
inFeatureLayer: (GMSFeatureLayer *)  featureLayer
atLocation: (CLLocationCoordinate2D)  location 
[optional]

Called after features in a data-driven styling feature layer have been tapped.

All features overlapping with the point being tapped will be included. If the features belong to different feature layers, this method will be called multiple times (once for each individual feature layer).

There is no guaranteed order between events on different feature layers, or between events on feature layers and other entities on the base map.

Parameters:
mapViewThe map view that was tapped.
featuresArray of all features being clicked in the layer.
featureLayerThe feature layer containing the feautre.
locationThe location of the actual tapping point.