Change Order of Layers

Discussion created by tdhs on Nov 10, 2010
I'm trying to change the order of the layer in my AGSMapView.
To change the index of a layer, I first remove the layer from the AGSMapView (field gisView) using the name (parameter uniqueName) of the layer:
NSDictionary<AGSLayerView>* dict = self.gisView.mapLayerViews;
id<AGSLayerView> agsLayerView = [dict objectForKey:uniqueName];
AGSLayer* gisLayer = [agsLayerView.agsLayer retain];
[self.gisView removeMapLayerWithName:uniqueName];

Then, I insert the layer again at the new index position:
[self.gisView insertMapLayer:gisLayer withName:uniqueName atIndex:index];

If the new index is larger than the old index (e.g. move layer from index 1 to 2), this works fine.
If the new index is smaller than the old index (e.g. move layer from index 2 to 1), this does not work.

If I enumerate the layers after removeMapLayerWithName/insertMapLayer:atIndex, the new order seems to be in effect, the layers are however not rendered in that order.

What am I missing? Is this a bug?