Solved! Go to Solution.
Dana,
I would rather just control the visibility in this manner per the release notes and as such want to know why this doesn't work. Moving the map ever-so-slightly seems like a hack.
...
To me it looks like any changes to the visibility property don't fire a new render even for the tile imagery in the layer. Same goes for the opacity property.
I checked out your demo and saw the behavior you are describing.
A quick fix is to very slightly shift the center of the map every time you toggle a layer. If you shift the center point by a very small multiplier, the map will update but not shift visibly. I am attaching a modified version of your demo that does such. I used a multiplier of 1.00001 and there is not visible map shift.
I find that the map renders more quickly if you just swap layers in and out of the map using addMapLayer: / removeMapLayer: . There does seem to be a cost to keeping track of empty layers on the map. This would also avoid your problem.
Dana,
I would rather just control the visibility in this manner per the release notes and as such want to know why this doesn't work. Moving the map ever-so-slightly seems like a hack.
...
To me it looks like any changes to the visibility property don't fire a new render even for the tile imagery in the layer. Same goes for the opacity property.
Yes, it is definitely a hack. Did you see my edit that you can achieve the same result with the - (void)refresh method of AGSLayer?