Sau khi bạn khởi tạo khung hiển thị bản đồ, đây là cách triển khai một uỷ quyền để xử lý các thay đổi về sự kiện khung hiển thị bản đồ khi xe di chuyển trong hành trình.
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.}
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-24 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"]]