<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Change Order of Layers in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/change-order-of-layers/m-p/61550#M578</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to change the order of the layer in my AGSMapView.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;NSDictionary&amp;lt;AGSLayerView&amp;gt;* dict = self.gisView.mapLayerViews;
id&amp;lt;AGSLayerView&amp;gt; agsLayerView = [dict objectForKey:uniqueName];
AGSLayer* gisLayer = [agsLayerView.agsLayer retain];
[self.gisView removeMapLayerWithName:uniqueName];&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then, I insert the layer again at the new index position:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;[self.gisView insertMapLayer:gisLayer withName:uniqueName atIndex:index];&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the new index is larger than the old index (e.g. move layer from index 1 to 2), this works fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the new index is smaller than the old index (e.g. move layer from index 2 to 1), this does not work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What am I missing? Is this a bug?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanx&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Nov 2010 12:38:28 GMT</pubDate>
    <dc:creator>MichaelBeck</dc:creator>
    <dc:date>2010-11-10T12:38:28Z</dc:date>
    <item>
      <title>Change Order of Layers</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/change-order-of-layers/m-p/61550#M578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to change the order of the layer in my AGSMapView.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;NSDictionary&amp;lt;AGSLayerView&amp;gt;* dict = self.gisView.mapLayerViews;
id&amp;lt;AGSLayerView&amp;gt; agsLayerView = [dict objectForKey:uniqueName];
AGSLayer* gisLayer = [agsLayerView.agsLayer retain];
[self.gisView removeMapLayerWithName:uniqueName];&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then, I insert the layer again at the new index position:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;[self.gisView insertMapLayer:gisLayer withName:uniqueName atIndex:index];&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the new index is larger than the old index (e.g. move layer from index 1 to 2), this works fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the new index is smaller than the old index (e.g. move layer from index 2 to 1), this does not work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What am I missing? Is this a bug?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanx&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Nov 2010 12:38:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/change-order-of-layers/m-p/61550#M578</guid>
      <dc:creator>MichaelBeck</dc:creator>
      <dc:date>2010-11-10T12:38:28Z</dc:date>
    </item>
  </channel>
</rss>

