我很努力地在iOS 8.0的Google Map中獲取多個標記。我當前的代碼是:多個標記Google Map iOS SDK
ResourceGroep *rsg = [ResourceGroep alloc]init;
GMSCameraPosition *camera = nil;
for (int i = 0; i < [rsg.chosenResourceArray count]; i++)
{
camera = [GMSCameraPosition cameraWithLatitude:[loc.Latitude doubleValue]
longitude:[loc.Long doubleValue]
zoom:15];
mapView_ = [GMSMapView mapWithFrame:self.view.bounds camera:camera];
mapView_.myLocationEnabled = NO;
CLLocationCoordinate2D position = { [rsg.Latitude doubleValue], [rsg.Long doubleValue] };
GMSMarker *marker = [GMSMarker markerWithPosition:position];
marker.title = [NSString stringWithFormat:@"Marker %i", i];
marker.appearAnimation = YES;
marker.flat = YES;
marker.snippet = @"";
marker.map = mapView_;
}
[self.view addSubview:mapView_];
我已經通過我的反覆排列,但我只看到1個標記,而我的陣列數量就像是2或3取決於選擇什麼樣的用戶。我錯過了什麼?
move camera = ...,mapView_ = ...從循環中移出。你每次創建新的mapView – kabarga 2014-10-06 08:12:45