I am working with the Google Maps iOS SDK with several markers that will display a marker info window on a marker. Below code works for several markers and markers displayed in map view as expected. It also displays a marker information window when a marker is clicked and changes the marker icon when clicked.
-(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 invoke a soft click on the marker or show the info window on the marker.
marker = [GMSMarker markerWithPosition:position]; marker.title = @"Name"; marker.snippet = @"Test"; [self mapView:_mapView didTapMarker:marker]; [_mapView setSelectedMarker:marker];
Above code does not work for me. It simply moves to the marker location, does not show the info window. Is there a way to programmatically click a marker and show the info window?
source share