How can we hide and show AGSGraphicsLayer in iOS?

3154
2
Jump to solution
08-02-2012 09:45 PM
KhurramWaqas
New Contributor
Hy I am using  two AGSGraphicsLayers in my app one for normal features and Graphics and another for Routing graphics and routing results. I want to handle the situation that if routing is solved and routing graphics layer is populated, its mean now this layer have graphics. Now I go to normal app showing features graphics layer and not the routing graphics layer as they are both on the same map. so i use
// remove all graphics  [self.graphicsLayerRouting removeAllGraphics];  [self.graphicsLayerRouting dataChanged];

so the routing results are removed. Now I came back to routing case again, means the routing layer is going to add again with NO GRAPHICS. But i need the last routing result.

Now please guide me that what i have to do to show the last routing graphics layer?
any idea about
1. How to hide the graphics layer and show it again?
2. or how to save the last graphics in array or dictionary format and on next time how should I re populate layer with that array or dictionary.

Thanks
Khurram
0 Kudos
1 Solution

Accepted Solutions
FrankXia
Esri Contributor
The easiest way to hide and show a graphics layer:

UIView<AGSLayerView> *layerView = [self.mapView.mapLayerViews objectForKey:graphiclayername];
layerView.hidden = YES; (or NO)

Hoep it helps

Frank

View solution in original post

0 Kudos
2 Replies
FrankXia
Esri Contributor
The easiest way to hide and show a graphics layer:

UIView<AGSLayerView> *layerView = [self.mapView.mapLayerViews objectForKey:graphiclayername];
layerView.hidden = YES; (or NO)

Hoep it helps

Frank
0 Kudos
KhurramWaqas
New Contributor
The easiest way to hide and show a graphics layer:

UIView<AGSLayerView> *layerView = [self.mapView.mapLayerViews objectForKey:graphiclayername];
layerView.hidden = YES; (or NO)

Hoep it helps

Frank


Many thanks frank, its working 🙂

Now If i want to save my last route results, as if i close the app completely (means the app is not in Memory) and run the app again and want to see the last routing results in routing mode then is it possible? if yes (i think yes) then please tell me how can i save the last results in core data or in any other way so i can achieve my goal to show the last result on the next time run of app.
0 Kudos