Etapa 2: processar eventos da visualização do mapa
Agora que você já inicializou a visualização do mapa, confira como implementar um delegado
para processar as mudanças de evento da visualização do mapa à medida que o veículo avança ao longo da jornada.
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.}
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-02-25 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"]]