ArcGIS API for iOS implements layer Display Control in two granularities: Service display control and layer display control.
1) Service Display Control
The service display control is implemented using agsmapview class. Each uiviewcontroller interface has an agsmapview object instance if a map is loaded. Set hidden = true for this agsmapview instance. For example, agstiledmapservicelayer * tiledlayer = [[agstiledmapservicelayer alloc] initwithurl: [nsurl urlwithstring: ktiledemapzonemapservice Url];
Uiview * emapzonetiledmap = [self. mapview addmaplayer: tiledlayer withname: @ "tiled layer"];
Emapzonetiledmap. Hidden = no; 2) display control of services in the map view
The display control of a single map service is implemented using agsdynamiclayerview or agstiledlayerview, for example:
Nsdictionary * dict = self. mapview. maplayerviews;
Nsarray * arr = [dict allvalues];
For (INT I = 0; I <[arr count]; I ++ ){
Agsdynamiclayerview * maplayerview = [arr objectatindex: I];
If (display control conditions ){
Maplayerview. Hidden = true;
}
}
3) display control of multiple layers in a single service
Nsurl * url = [nsurl urlwithstring: @ "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer"]; agsdynamicmapservicelaye R *
Layer = [agsdynamicmapservicelaye R dynamicmapservicelayerwi Thurl: url];
// Only display 'ushigh' (ID = 0) and 'states' (ID = 1) Layer
Layer. visiblelayers = [nsarray arraywithobjects: [nsnumber numberwithint: 0], [nsnumber numberwithint: 1], nil];
Determine whether the layer is visible by setting visiblelayers.
4) Summary
The object model diagram is as follows:
In fact, both agsmapview and agslayerview objects are subclasses of uiview, so the final control is whether the uiview is visible. In this way, you can control the layer display by setting whether the uiview is hidden.