0

I am trying to Shown the marker and it's info window together in ios when I tapped on map but didn't work for me here is my sample of code

 - (void) mapView:      (GMSMapView *)  mapView
    didTapAtCoordinate:     (CLLocationCoordinate2D)    coordinate{
        CLLocation *destination_lat_long = [[CLLocation alloc]initWithLatitude:coordinate.latitude longitude:coordinate.longitude];
        GMSMarker *marker_test = [[GMSMarker alloc] init];
        marker_test.position = coordinate;
        marker_test.title = @"Location selected";
        marker_test.snippet = @"Testing";
        marker_test.map = self.MyMapView;
        
        //Show info window on map
        [self.MyMapView setSelectedMarker:marker];
    }

I don't understand why it's not working?
I want to populate the info window on marker set.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Sagar Devani
  • 242
  • 1
  • 3
  • 10
  • Your code seems fine. Do you have the property self.MyMapView assigned to the IB object ? Take a look here, it could help you : http://stackoverflow.com/questions/15816684/how-to-show-a-info-window-in-ios-google-maps-without-tapping-on-marker – Radim Halfar Oct 04 '14 at 12:53
  • @RadimHalfar yes i did already, when i tapped on marker infowindow is showing already but i want both marker and infowindow together without tapping on marker so is that possible? – Sagar Devani Oct 04 '14 at 13:08

1 Answers1

0

Related to comments:
Sure you can but I think without making custom Markers and InfoWindows it is only possible for one marker:

GMSMarkerOptions *myLocationOptions = [GMSMarkerOptions options];
myLocationOptions.title = @"Your title goes here";
myLocationOptions.snippet = @"Snippet goes here";

self.MapView.selectedMarker = [self.MapView addMarkerWithOptions: locationOptions];

But if you want to show more markers with their infoWindows you'll have to make a custom solution.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Radim Halfar
  • 536
  • 2
  • 6
  • 15