【发布时间】:2023-03-09 08:45:01
【问题描述】:
首先我创建一个带有用户位置的地图
-(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;
}
标记重复使用相同的标题。谁能帮助我在哪里做错了?
【问题讨论】:
-
能否给出经纬度的数组
-
我也看到我的地图也在重复,当我滚动地图时,我可以一次又一次地看到相同的国家
标签: ios google-maps google-maps-api-3 google-maps-markers