<?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 Re: toggle basemap layer? in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/toggle-basemap-layer/m-p/135365#M1260</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks!, but the idea is not to have more than one TiledMapLayer loaded at a time. Yes, I've tried the alphaSlider property and NO LUCK. So far, the solution I came up it's working pretty good I only need to use Zombies to clear the Object references which it creates on every single toggle. I am interested to know how can I instantiate an object of TiledMapLayer in .h and initialize it in implement .m class. I can do it very easilly when I am using feature layers such graphics layer, but I am not sure how to do it using TiledMapLayer which can save my whole lots memory and avoid crushing the program.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@interface.......{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AGSTileMapServiceLayer *LayerName;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;@property......... AGSTileMapServiceLayer *LayerName;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;@end&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@implement&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;@synthesize AGSTileMapServiceLayer LayerName;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-(void) viewDidLoad{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried couple other ways but none of them worked. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CAN SOMEONE PLEASE COMPLETE THIS FOR ME BY INITIALIZING THEN ADDING AGSTiledMapLayer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Rao&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GeoSurfInc.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Jun 2010 16:54:19 GMT</pubDate>
    <dc:creator>AkhlaqRao</dc:creator>
    <dc:date>2010-06-18T16:54:19Z</dc:date>
    <item>
      <title>toggle basemap layer?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/toggle-basemap-layer/m-p/135362#M1257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to toggle between two base map layers, i.e. I am using segmented tool to switch from one base layer let's say street view to satellite view. I am not quite sure if I can use VisibleLayer property while using AGSTiledMapLayer and also if I can then how to use this property?. Please give me an example since I am fairly new on ArcGis.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Rao&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GeoSurfInc.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jun 2010 16:03:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/toggle-basemap-layer/m-p/135362#M1257</guid>
      <dc:creator>AkhlaqRao</dc:creator>
      <dc:date>2010-06-17T16:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: toggle basemap layer?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/toggle-basemap-layer/m-p/135363#M1258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I made it working, but I am not sure how efficient it is. All I did is very simple by one "if and else" condition and removed all the Layers by the time it toggles including base map layer and added new layers accordingly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code as follows will not work if you tried as it is, please modify according to your need:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if (((UISegmentedControl *) sender). selectedSegmentIndex ==1 or 0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//---------Number of layers you want to remove.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[self.mapView removeMapLayerWithName:@"LayerName"];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//--------Number of layers you want to add.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//-------Ofcourse you need to create an instance of MapLayer first.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[self.mapView addMapLayer:LayerName withName:@"LayerName"];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//---------Number of layers you want to remove.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[self.mapView removeMapLayerWithName:@"LayerName"];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//--------Number of layers you want to add.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//-------Ofcourse you need to create an instance of MapLayer first.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[self.mapView addMapLayer:LayerName withName:@"LayerName"];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"NOW THE QUESTION IS, CAN WE DO BETTER THAN THIS???"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Rao&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GeoSurfInc.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jun 2010 12:02:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/toggle-basemap-layer/m-p/135363#M1258</guid>
      <dc:creator>AkhlaqRao</dc:creator>
      <dc:date>2010-06-18T12:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: toggle basemap layer?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/toggle-basemap-layer/m-p/135364#M1259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I load 3 different AGSTiledMapService layers into a static model class when the AppDelegate first runs.&amp;nbsp; Then, depending on how the user interacts with the app, I swap out basemaps on the fly.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is a "loaded" boolean property on AGSTiledMapServiceLayer...I set a basemap property on my main map view that holds my AGSMapView as the user interacts with the app.&amp;nbsp; Then I check for the boolean "loaded" property.&amp;nbsp; If it's loaded and the current basemap is not the same as the one that I am trying to load, it swaps it out.&amp;nbsp; See below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;-(void) changeBasemap{
 
 iLenexaModel *myModel = [iLenexaModel sharedModel];
 
 if (myBasemap.loaded==YES) {
&amp;nbsp; NSLog(@"the basemap is loaded...");
&amp;nbsp; [mapView removeMapLayerWithName:@"myBasemap"];
&amp;nbsp; [mapView addMapLayer:myBasemap withName:@"myBasemap"];
&amp;nbsp; [mapView addMapLayer:myModel.aerials withName:@"aerials"];
 
 }
 
 else if(myBasemap.loaded==NO){
&amp;nbsp; NSLog(@"The basemap is not loaded...");
&amp;nbsp; //[self addLenexaTiledMapLayerURL:myBasemap.URL :@"myBasemap"];
&amp;nbsp; 
&amp;nbsp; [mapView addMapLayer:myBasemap withName:@"myBasemap"];
&amp;nbsp; [mapView addMapLayer:myModel.aerials withName:@"aerials"];
&amp;nbsp; 
 }
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could also add both layers to the AGSMapView, and then alter the "alpha" property from 1.0 to 0.0, depending on the user's selection on your toggle control.&amp;nbsp; I have a similar set up with a UISlider, but I haven't had much luck with getting it to correctly show through the AGSTiledMapServiceLayer that is on top...There is an Opaque property shown in the XCode autocomplete, but I can't find much about it.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;[mySlider addTarget:self action:@selector(handleSliderChange:) forControlEvents:UIControlEventTouchDragInside];&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;-(IBAction)handleSliderChange:(id)sender{
 
 NSLog(@"value : %f", self.mySlider.value);
 //NSLog(basemapName);
 AGSTiledLayerView *basemapView = [self.mapView.mapLayerViews objectForKey:@"myBasemap"];
 //basemapView.opaque = NO;
 basemapView.alpha = self.mySlider.value;
 
 //AGSTiledLayerView *aerialsView = [self.mapView.mapLayerViews objectForKey:@"aerials"];
 //aerialsView.alpha = 1.0;
 
 // [basemapView release];
 
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:33:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/toggle-basemap-layer/m-p/135364#M1259</guid>
      <dc:creator>JeremyBixby</dc:creator>
      <dc:date>2021-12-11T07:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: toggle basemap layer?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/toggle-basemap-layer/m-p/135365#M1260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks!, but the idea is not to have more than one TiledMapLayer loaded at a time. Yes, I've tried the alphaSlider property and NO LUCK. So far, the solution I came up it's working pretty good I only need to use Zombies to clear the Object references which it creates on every single toggle. I am interested to know how can I instantiate an object of TiledMapLayer in .h and initialize it in implement .m class. I can do it very easilly when I am using feature layers such graphics layer, but I am not sure how to do it using TiledMapLayer which can save my whole lots memory and avoid crushing the program.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@interface.......{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AGSTileMapServiceLayer *LayerName;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;@property......... AGSTileMapServiceLayer *LayerName;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;@end&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@implement&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;@synthesize AGSTileMapServiceLayer LayerName;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-(void) viewDidLoad{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried couple other ways but none of them worked. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CAN SOMEONE PLEASE COMPLETE THIS FOR ME BY INITIALIZING THEN ADDING AGSTiledMapLayer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Rao&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GeoSurfInc.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jun 2010 16:54:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/toggle-basemap-layer/m-p/135365#M1260</guid>
      <dc:creator>AkhlaqRao</dc:creator>
      <dc:date>2010-06-18T16:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: toggle basemap layer?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/toggle-basemap-layer/m-p/135366#M1261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have more than 4 layers in my web app but i want to toggle between only two layers how do i do this using checkbox or radio button.I tried using javascript and c# both the time i was unsuccessful.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Feb 2011 08:50:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/toggle-basemap-layer/m-p/135366#M1261</guid>
      <dc:creator>ManojrajTeli</dc:creator>
      <dc:date>2011-02-08T08:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: toggle basemap layer?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/toggle-basemap-layer/m-p/135367#M1262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This seems to work OK:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- (void)viewDidLoad {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [super viewDidLoad];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // set the delegate for the map view&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; self.mapView.mapViewDelegate = self;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; //create an instance of a tiled map service lay&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt; self.tiledBasemapLayer = [[AGSTiledMapServiceLayer alloc] initWithURL:[NSURL URLWithString:@"&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" rel="nofollow" target="_blank"&gt;http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer&lt;/A&gt;&lt;SPAN&gt;"]];&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; [self.mapView addMapLayer:self.tiledBasemapLayer withName:@"Basemap1"];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; //release to avoid memory leaks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; [self.tiledBasemapLayer release];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; //create an instance of a dynmaic map layer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; self.dynamicLayer = [[[AGSDynamicMapServiceLayer alloc] initWithURL:[NSURL URLWithString:kDynamicMapServiceURL]] autorelease];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; //name the layer. This is the name that is displayed if there was a property page, tocs, etc...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; self.dynamicLayerView = [self.mapView addMapLayer:self.dynamicLayer withName:@"Layer1"];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; //set transparency&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; self.dynamicLayerView.alpha = 1.0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// create and add the graphics layer to the map&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; self.graphicsLayer = [AGSGraphicsLayer graphicsLayer];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; [self.mapView addMapLayer:self.graphicsLayer withName:@"Graphics Layer"];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;to toggle the basemap there is a button that sets a new basmapurl &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; NSString *newBasemapURL = (your rest url)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; if (newBasemapURL != nil) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; //idea is that we have one basemap at all times, and its either called Basemap1 or Basemap2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; //the basemap is always at index 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; //when the app starts we have one basemap at index 0 called Basemap1 and&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; //a dynamic layer on top at index 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; //Note that if you remove the current basemap before inserting the new one, the dynmaic layer will be under the new basemap,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; //so we need to add the new one at index 0, then remove the old basemap using its unique name&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; //create new tilelayer for new basemap&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; self.tiledBasemapLayer = [[AGSTiledMapServiceLayer alloc] initWithURL:[NSURL URLWithString:newBasemapURL]];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; //create a string to compare name of current basemap to&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; NSString *baseMapStr = @"Basemap1";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; //get the names of the layers in the map&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; NSArray *myLyrArray = [self.mapView mapLayerNames];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; //print out the names of the layers to the log &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; NSLog(@"array: %@", myLyrArray);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; //see if the current basemap is called Basemap1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; if ([baseMapStr isEqualToString:[myLyrArray objectAtIndex:0]]) {&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; [self.mapView insertMapLayer:self.tiledBasemapLayer withName:@"Basemap2" atIndex:0];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; [self.mapView removeMapLayerWithName:@"Basemap1"]; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; else { //its called basemap2 then ....&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; [self.mapView insertMapLayer:self.tiledBasemapLayer withName:@"Basemap1" atIndex:0];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; [self.mapView removeMapLayerWithName:@"Basemap2"]; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; } &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [self.tiledBasemapLayer release];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2011 17:22:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/toggle-basemap-layer/m-p/135367#M1262</guid>
      <dc:creator>BradyHoak</dc:creator>
      <dc:date>2011-03-28T17:22:24Z</dc:date>
    </item>
  </channel>
</rss>

