Adding Click Event on InfoWindow/Marker in Google Maps SDK for native iOS/objective C

后端 未结 7 2117
无人及你
无人及你 2020-12-05 05:41

Simple Question

I´m working on an App for iOS where I embedded the new Google Map for native iOS. Everything works fine except one problem where I can´t find a propp

7条回答
  •  鱼传尺愫
    2020-12-05 06:02

    1.conform to the GMSMapViewDelegate protocol.

    @interface YourViewController () 
    // your properties
    @end
    

    2.set your mapView_ delegate.

    mapView_.delegate = self;
    

    3.implement the GMSMapViewDelegate method

    - (void)mapView:(GMSMapView *)mapView didTapInfoWindowOfMarker:(GMSMarker *)marker {
        // your code
    }
    

    btw, marker.userData is useful. you can set your needed data into it and use it in - mapView:didTapInfoWindowOfMarker:

提交回复
热议问题