Rahul Vyas Rahul Vyas - 1 year ago 126
iOS Question

Google map ios sdk info window only appear on 2 taps

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,
self.shuttleInfoWindow.delegate = self;

Answer Source

try writing this delegate :

- (BOOL)mapView:(GMSMapView*)mapView didTapMarker:(GMSMarker*)marker
    [mapview setSelectedMarker:marker];
    return YES;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download