我試圖創建標記而不點擊。但我不能顯示所有的infoWindows。它只在最後一個標記上顯示一個infowindow。如何顯示iOS中的所有信息窗口Google地圖無需點擊標記?
這裏是我的代碼:
- (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];
}
}
和自定義信息窗口:
- (UIView*)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker {
CustomInforwindow *customView = [[[NSBundle mainBundle] loadNibNamed:@"CustomInforwindow" owner:self options:nil] objectAtIndex:0];
return customView;
}
地方兩個標誌(請保持兩者之間一定的差距)和刪除兩者的交互。例如marker1.position = Locationcoorsinate2dobject; marker2.position = Locationcoorsinate2dobject; | marker1.tappable = FALSE; marker2.tappable = FALSE;現在,魔法會發生。marker2.groundanchor = CGPointMake(marker1.groundanchor.x,marker1.gorundanchor.y + 2 .7);希望這有助於快樂編碼:) –