Select to view content in your preferred language

how to add two map to a view controller

547
1
03-14-2011 01:53 PM
FatihTEKCAN
New Contributor
I want to add two AGSMapview to  MainViewController. I archieve adding mapviews to controller and adding AGSGraphicsLayers to this maps. But the problem is that my graphics on the graphics layers are not drawn correctly. My code :

-(void)viewDidLoad{
AGSMapview mapView1 =[[AGSMapView alloc]initWithFrame:.......];

AGSMapview mapView2 =[[AGSMapView alloc]initWithFrame:.......];
// add tiled map service layers to maps

AGSTiledMapServiceLayer *tiledLayer1 = [AGSTiledMapServiceLayer  ....];
AGSTiledMapServiceLayer *tiledLayer2 = [AGSTiledMapServiceLayer  ......];

AGSGraphicsLayer *graphicsLayer1 = ......
AGSGraphicsLayer *graphicsLayer2 = ......

  [self.mapView1 addMapLayer:tiledLayer1 withName:@"Tiled Layer 1"];
[self.mapView2 addMapLayer:tiledLayer2 withName:@"Tiled Layer 2"];

[self.mapView1 addMapLayer:graphicsLayer1 withName:@"Graphics Layer 1"];
[self.mapView1 addMapLayer:graphicsLayer2 withName:@"Graphics Layer 2"];
}

-(void)mapViewDidLoad:(AGSMapView*)mapView{
AGSMutablePolyLine poly1 , poly2;
AGSSimpleLineSymbol *line1 = ......;
AGSSimpleLineSymbol *line2 = ......
AGSGraphic* myGraphic1 = ......;

AGSGraphic* myGraphic2 = ....... ;


[graphicsLayer1 addGraphic:myGraphic1 ];
[graphicsLayer1 dataChanged];

[graphicsLayer2 addGraphic:myGraphic2];
[graphicsLayer2 dataChanged];
}


if i add only one map to controller , graphics are correct. But if i add two map to controller graphics are drawn wrong.

Briefly , How to I add two mapview to UIViewController with graphics layer ?
0 Kudos
1 Reply
NimeshJarecha
Esri Regular Contributor
If possible, can you please attach your sample project so I can look at it and help you with?

Regards,
Nimesh
0 Kudos