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;
}
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With