AnsweredAssumed Answered

Hide/Show AGSLayer

Question asked by aconnolly on Jan 29, 2013
Latest reply on Feb 4, 2013 by aconnolly

Prior to 10.1 when you wanted to toggle the visibility of  layers you had to retain a copy of a layer's UIView and use the UIView's hidden property. The release notes now say to NOT do this, but rather to use the visible property on AGSLayer.

I'm having trouble getting this to work. I add 3 layers to a map, then toggle either their visible property or the opacity property to (YES/NO, 0.0/1.0 respectively) to show / hide them. This does not work because the layers themselves sometimes won't load tiles until you interact with the map.

This is troublesome as I would expect the map to load it's tiles as soon as it's been made visible. Is that not the case? How should I go about toggling the layers visibility like this AND have the tile imagery load, without the map having moved previously?

In my example the streets layer should load because its the one that's visible at first. The Topo and Imagery layers, if you switch to them with the buttons below, will not display tiles until you move the map. Sometimes this works, sometimes it doesn't. For example on the iPhone simulator the Topo layer would not work, but the Imagery did work. On iPad simulator neither Topo nor Imagery would load until you moved the map.

I've attached a sample project demonstrating this issue.

- Aaron