Google map ios sdk info window only appear on 2 taps

198 views Asked by At

I am using google maps ios sdk. I have created a custom xib file for info window.

The issue I am getting is whenever I tap on a marker it the google map automatically makes the marker in center and then on next tap info window is displayed.

What I want is the tapped marker should display info window on immediately instead of tap on second time

Here is the code I'm using

- (UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker {

    if (marker != self.pointMarker) {
        if (!self.shuttleInfoWindow) {
            [self initShuttleInfoWindowObject];
        }

        Shuttle* shuttle = (Shuttle*)marker.userData;
        if (shuttle) {
            [self.shuttleInfoWindow setCurrentShuttle:shuttle];

        }
        self.shuttleInfoWindow.isInfoWindowDisplayed = YES;
        return self.shuttleInfoWindow;
    }
    return nil;


}


- (void)initShuttleInfoWindowObject {
    self.shuttleInfoWindow =  [[[NSBundle mainBundle] loadNibNamed:@"InfoWindow" owner:self options:nil] objectAtIndex:0];
    [self.shuttleInfoWindow setFrame:CGRectMake(0,
                                                0,
                                                self.shuttleInfoWindow.frame.size.width,
                                                self.shuttleInfoWindow.frame.size.height)];
    self.shuttleInfoWindow.delegate = self;
}
1

There are 1 answers

6
Anjali Bhimani On BEST ANSWER

try writing this delegate :

- (BOOL)mapView:(GMSMapView*)mapView didTapMarker:(GMSMarker*)marker
{
    [mapview setSelectedMarker:marker];
    return YES;
}