ios谷歌地图绘制多个标记问题(信息窗口和标记重复)

ios谷歌地图绘制多个标记问题(信息窗口和标记重复),ios,google-maps,google-maps-api-3,google-maps-markers,Ios,Google Maps,Google Maps Api 3,Google Maps Markers,首先,我创建一个带有用户位置的地图 -(void)initGogleMapView{ GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:currentLocation.coordinate.latitude longitude:currentLocation.coordinate.longitude

首先,我创建一个带有用户位置的地图

-(void)initGogleMapView{

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:currentLocation.coordinate.latitude
                                                        longitude:currentLocation.coordinate.longitude
                                                             zoom:1];

mapView = [GMSMapView mapWithFrame:CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height-64) camera:camera];
[self.view addSubview:mapView];
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = camera.target;

marker.appearAnimation = kGMSMarkerAnimationPop;
marker.map = mapView;
marker.title=@"Current Location";


}
然后我有一个纬度和经度的数组,并在for循环中绘制

   for(int i=0;i<[latLongArr count];i++)
         {
             GMSMarker *tempmarker = [[GMSMarker alloc] init];
             tempmarker.position = CLLocationCoordinate2DMake([[[latLongArr objectAtIndex:i] valueForKey:@"Latitude"] floatValue],[[[latLongArr objectAtIndex:i] valueForKey:@"Longitude"] floatValue]);
             tempmarker.title=[[latLongArr objectAtIndex:i] valueForKey:@"Name"];
             tempmarker.appearAnimation = kGMSMarkerAnimationPop;

             tempmarker.map = mapView;



         }

for(int i=0;i首先检查数组中的纬度和经度,它可能是重复的。否则,请执行以下步骤:

首先,将
GoogleMaps.bundle
GoogleMaps.framework
添加到项目中。 然后,当您想要实现google地图时,
#导入
,然后将委托
@接口设置为YourViewController:UIViewController

.h

@property (nonatomic, retain) GMSMapView *gMapView;
viewDidLoad()中

已将多个标记添加到地图的位置

for(int i=0;i<[latLongArr count];i++)
{
   GMSMarker *marker = [[GMSMarker alloc] init];
   marker.position = CLLocationCoordinate2DMake([[(NSDictionary *)[latLongArr objectAtIndex:i] valueForKey:@"Latitude"] doubleValue], [[(NSDictionary *)[latLongArr objectAtIndex:i] valueForKey:@"Longitude"] doubleValue]);
   marker.appearAnimation = kGMSMarkerAnimationPop;
   marker.title = @"Title";
   marker.snippet = @"Sub title";
   marker.map = self.gMapView;
}

对于(int i=0;我能请你给出纬度和经度的数组吗?所以我看到我的地图也在重复,当我滚动地图时,我可以一次又一次地看到相同的国家实际上我看到我的地图也在重复,当我滚动地图时,我可以一次又一次地看到相同的国家
for(int i=0;i<[latLongArr count];i++)
{
   GMSMarker *marker = [[GMSMarker alloc] init];
   marker.position = CLLocationCoordinate2DMake([[(NSDictionary *)[latLongArr objectAtIndex:i] valueForKey:@"Latitude"] doubleValue], [[(NSDictionary *)[latLongArr objectAtIndex:i] valueForKey:@"Longitude"] doubleValue]);
   marker.appearAnimation = kGMSMarkerAnimationPop;
   marker.title = @"Title";
   marker.snippet = @"Sub title";
   marker.map = self.gMapView;
}