Select to view content in your preferred language

Setting visibility of AGSLayer

822
2
10-24-2010 10:19 AM
VladimirDzyuba
New Contributor
Hi!

Is there any opportunity to set visibility of AGSLayer (specifically AGSDynamicMapServiceLayer or AGSTiledMapServiceLayer) as a whole?

Something like "layer.visible = NO", which prevents querying the server and drawing?
0 Kudos
2 Replies
NimeshJarecha
Esri Regular Contributor
The AGSMapView::addMapLayer returns a UIView. You can use it's hidden property to control the visibility of the layer. It'll prevents querying the server and drawing.

NSURL* url = [NSURL URLWithString: @" http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"];
AGSTiledMapServiceLayer* layer = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL: url];
UIView<AGSLayerView>* lyrView = [mapView addMapLayer:layer withName:@"Streets"];
lyrView.hidden = YES;

Hope this helps!

Regards,
Nimesh
0 Kudos
VladimirDzyuba
New Contributor
The AGSMapView::addMapLayer returns a UIView. You can use it's hidden property to control the visibility of the layer. It'll prevents querying the server and drawing.

NSURL* url = [NSURL URLWithString: @" http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"];
AGSTiledMapServiceLayer* layer = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL: url];
UIView<AGSLayerView>* lyrView = [mapView addMapLayer:layer withName:@"Streets"];
lyrView.hidden = YES;

Hope this helps!

Regards,
Nimesh


Yes, Nimesh, this fully solves the problem.

Right now I see, that I missed this point while reading the tutorial. Shame on me and thank you 🙂
0 Kudos