Schritt 2: Ereignisse in der Kartenansicht verarbeiten
Nachdem Sie die Kartenansicht initialisiert haben, erfahren Sie hier, wie Sie einen Delegaten implementieren, um Ereignisänderungen in der Kartenansicht zu verarbeiten, während sich das Fahrzeug auf der Route bewegt.
Swift
funcmapViewDidInitialize(_mapview:GMTCMapView){// Handle the update to the state of the map view to browsing.}funcmapView(_mapView:GMSMapView,didTapConsumerMarkermapMarker:GMSMarker,markerType:GMTCMapViewMarkerType)->Bool{// Handle the mapView marker was tapped.}
Objective-C
/* * MapViewController.m */#pragma mark - GMTCMapViewDelegate implementation// Handle state update of map view.-(void)mapViewDidInitializeCustomerState:(GMTCMapView*)mapview{// Handle the update to the state of the map view to browsing.}-(void)mapView:(GMSMapView*)mapViewdidTapConsumerMarker:(nonnullGMSMarker*)mapMarkermarkerType:(GMTCMapViewMarkerType)markerType{// Handle the mapView marker was tapped.}
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-06-13 (UTC)."],[[["This documentation outlines how to set up and use the Google Maps SDK for iOS to track and display trips in real-time within your application."],["The guide covers initializing the map view, enabling user location, and handling events like the map becoming ready and marker taps."],["You can customize the appearance of the map using styling options provided by the SDK, as well as follow a vehicle's trip progression with built-in features."]]],["This content details how to set up a map to follow a trip in iOS. The process involves two key steps: first, initializing the map view (`GMTCMapView`) within a view controller, as demonstrated in Swift and Objective-C code examples. Second, implementing a delegate to handle map view events, which includes managing state updates and responding to marker taps. Customization of the map's style and the process to follow a trip are suggested as next steps.\n"]]