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

Corona picture Corona · Mar 12, 2013 · Viewed 34.9k times · Source

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 propper solution for native IOS/ Objective-C neither here nor at google (if there is one please show me and sorry for annoying you)

What I want: I want the User to Click on the Marker that opens the Info Window. After If he clicks or taps on the Info Window it should open a New UIView with further Informations.

How can I do that?

Thanks for advices

Answer

Brian picture Brian · May 7, 2013

1.conform to the GMSMapViewDelegate protocol.

@interface YourViewController () <GMSMapViewDelegate>
// 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: