How to show a Info window in iOS Google maps without tapping on Marker?
This has changed on Google Maps SDK and it's easier to understand:
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = coordinate;
marker.title = @"Location selected";
marker.snippet = @"Testing";
marker.map = mapView_;
//Show info window on map
[mapView_ setSelectedMarker:marker];
You use now setSelectedMarker method to show an info window of a marker
GMSMarkerOptions *myLocationOptions = [GMSMarkerOptions options];
myLocationOptions.title = @"My Location";
myLocationOptions.snippet = @"Lat:...., Lang:....";
mapView.selectedMarker = [mapView addMarkerWithOptions:myLocationOptions];
(note that it's Options, not Option)
Swift 3.0
func addMarker(_ location:CLLocation){
var locationMarker: GMSMarker!
if locationMarker != nil {
locationMarker.map = nil
}
locationMarker = GMSMarker(position: location.coordinate)
locationMarker.map = mapView
locationMarker.appearAnimation = kGMSMarkerAnimationPop
locationMarker.icon = GMSMarker.markerImage(with: UIColor.green)
locationMarker.opacity = 0.85
locationMarker.isFlat = true
locationMarker.snippet = "My Location"
mapView.selectedMarker=locationMarker
}
below line is the answer
mapView.selectedMarker=locationMarker