I am working with Google Maps iOS SDK with multiple markers which will show marker info window on marker tap. Below code works for multiple markers and marker displayed in the Map View as expected. Its also show the marker info window on marker click and change the marker icon on click.
-(UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)imarker
{
UIView *infowindow = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 90, 45)];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 90, 45)];
[label setFont:[UIFont fontWithName:@"TrebuchetMS-Bold" size:22]];
infowindow.layer.cornerRadius = 5;
infowindow.layer.borderWidth = 2;
label.textAlignment = NSTextAlignmentCenter;
label.text = @"Test";
label.textColor=[UIColor greenColor];
infowindow.backgroundColor=[UIColor whiteColor];
[infowindow addSubview:label];
return infowindow;
}
Now i want to trigger programatically click on marker or show info window on marker.
marker = [GMSMarker markerWithPosition:position];
marker.title = @"Name";
marker.snippet = @"Test";
[self mapView:_mapView didTapMarker:marker];
[_mapView setSelectedMarker:marker];
Above code not working for me. It just move to location of marker does not show the info window. Is there any way to programatically click on marker and show info window?
Providing map to the marker is essential
For Obj c
For Swift 3.0