Stay organized with collections Save and categorize content based on your preferences.
When specific advanced marker properties are set, you can monitor marker events such as taps and gestures. If a marker is tapped, one can see additional information such as a marker title or snippet. One can also move draggable markers using a long press gesture.
GMSMapViewDelegate
to your view
.GMSMarker.draggable
property.GMSMarker.title
property.You can respond to marker events by adding the GMSMapViewDelegate
protocol to your view and implementing the corresponding callback. This example identifies the title
and snippet
for a selected marker.
// MARK: GMSMapViewDelegate func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool { if let title = marker.title { if let snippet = marker.snippet { print("marker title: \(title): snippet: \(snippet)") } } return true }Objective-C
// MARK: GMSMapViewDelegate - (BOOL)mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)marker { if (marker.title && marker.snippet) { NSLog(@"marker with title:%@ snippet: %@", marker.title, marker.snippet) } return YES; }Control marker visibility by map zoom level
To control the visibility of GMSMarker
, implement the GMSMapViewDelegate
protocol and add a condition to set GMSMarker.map
.
// MARK: GMSMapViewDelegate func mapView(_ mapView: GMSMapView, didChange position: GMSCameraPosition) { marker.map = position.zoom >= 14 ? mapView : nil }Objective-C
// MARK: GMSMapViewDelegate - (void)mapView:(GMSMapView *)mapView didChangeCameraPosition:(GMSCameraPosition *)position { marker.map = position.zoom >= 14 ? mapView : nil; }Make a marker draggable
When you enable the draggable
property users can drag markers on the map with a long press gesture. To make a marker draggable, set the GMSMarker.draggable
property to true.
marker.draggable = trueObjective-C
marker.draggable = YES;
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-23 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-23 UTC."],[[["Google Maps SDK for iOS allows you to monitor marker events like taps and gestures, displaying information like title and snippet when tapped."],["You can enable marker dragging using a long press gesture by setting the `GMSMarker.draggable` property."],["Marker visibility can be controlled based on the map's zoom level using the `GMSMapViewDelegate` and setting the `GMSMarker.map` property conditionally."],["To respond to marker events and access details like title and snippet, implement the `GMSMapViewDelegate` protocol and its corresponding callback methods."]]],["Markers' events, like taps and gestures, can be monitored by adding `GMSMapViewDelegate`. Tapped markers reveal their title and snippet, set using `GMSMarker.title`. Markers can be made draggable with `GMSMarker.draggable`, allowing movement via long press. You can control marker visibility based on zoom level by setting `GMSMarker.map` within the `GMSMapViewDelegate` callback. Implementing the delegate protocol also allows for handling custom responses to specific marker interactions.\n"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4