Use the addLayer method. For example, this is from the header file from a map nib I have:-(void) addLenexaTiledMapLayer:(NSString*)layerURL:(NSString*) lyrName;
-(void) addLenexaTiledMapLayerURL:(NSURL*)layerURL:(NSString*) lyrName;
-(void) removeLenexaMapLayer:(NSString*)layerName;
-(void) addLenexaDynamicMapLayer:(NSString*)layerURL:(NSString*) lyrName;
And here is the implementations of said functions, in the .m file:-(void) addLenexaTiledMapLayerURL:(NSURL*)layerURL:(NSString*)lyrName{
AGSTiledMapServiceLayer *tiledMapLyr = [[AGSTiledMapServiceLayer alloc] initWithURL:layerURL];
[mapView addMapLayer:tiledMapLyr withName:lyrName];
[tiledMapLyr release];
}
-(void) addLenexaTiledMapLayer:(NSString*)layerURL:(NSString*)lyrName{
AGSTiledMapServiceLayer *tiledMapLyr = [[AGSTiledMapServiceLayer alloc] initWithURL:[NSURL URLWithString:layerURL]];
[mapView addMapLayer:tiledMapLyr withName:lyrName];
[tiledMapLyr release];
}
-(void) removeLenexaMapLayer:(NSString*)layerURL:(NSString*)lyrName{
[mapView removeMapLayerWithName:lyrName];
}
-(void) addLenexaDynamicMapLayer:(NSString*)layerURL:(NSString*)lyrName{
AGSDynamicMapServiceLayer *dynaMapLyr = [[AGSDynamicMapServiceLayer alloc] initWithURL:[NSURL URLWithString:layerURL]];
dynaMapLyr.dpi = 96;
[mapView addMapLayer:dynaMapLyr withName:lyrName];
[dynaMapLyr release];
}
and then if you want to access the layer once it's been added to the map, use the appropriate layerview object: AGSTiledLayerView *basemapView = [self.mapView.mapLayerViews objectForKey:@"myBasemap"];
basemapView.alpha = self.mySlider.value;