Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show all Info window in iOS Google maps without tapping on Marker?

I'm trying to create markers without tapping. But i cant display all infoWindows. It only show one infowindow on last marker.

Here is my code:

- (void)viewDidLoad {
    [super viewDidLoad];
    NSMutableArray *markersArray = [[NSMutableArray alloc] init];
    for(int i=0; i<10; i++){
        GMSMarker *marker = [[GMSMarker alloc] init];
        marker.position = CLLocationCoordinate2DMake(latitude, longitude);
        marker.appearAnimation=YES;
        marker.opacity = 0.0;
        mapView.selectedMarker = marker;
        marker.map = mapView;
        [markersArray addObject:marker];
    }
}

and custom Infowindow:

- (UIView*)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker {
    CustomInforwindow *customView =  [[[NSBundle mainBundle] loadNibNamed:@"CustomInforwindow" owner:self options:nil] objectAtIndex:0];
    return customView;
}
like image 270
TienLe Avatar asked Dec 20 '22 14:12

TienLe


1 Answers

you can display one InfoWindow at a time.

mapView.selectedMarker = marker; this will open the infowindow for the last marker

If you want to show multiple markers then you should make marker that contains both the marker and the info window .

Hope this helps.

like image 92
Sunny Shah Avatar answered Dec 29 '22 00:12

Sunny Shah