How can I intercept marker links in the Google Maps SDK for iOS?

I am new to the Google Maps SDK for iOS. When the user clicks on the marker, instead of showing the default info window with a title and a snippet, I would like to direct them somewhere else in my application (for example, a modal view controller). I looked through the header files online, and I can’t find anything regarding touch events on markers. Does anyone have suggestions or workarounds?

+5
source share
1 answer

I believe you want to add a delegate and override the method didTapMarker

/**
 * Called after a marker has been tapped.
 *
 * @param mapView The map view that was pressed.
 * @param marker The marker that was pressed.
 * @return 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.
 */
- (BOOL)mapView:(GMSMapView *)mapView didTapMarker:(id<GMSMarker>)marker;
+14
source

All Articles