Set the Property: AGSDynamicLayerView.visibleLayer

423
1
12-10-2011 05:16 AM
ZillaPlace
New Contributor
Hi guys,

I want to change the visibility of a layer within a map service. From the documentation, it's clear to set AGSDynamicLayerView.visibleLayer with the array of visible layer ids. However, it doesn't seem working for me. Even when I manually zoom in/out the map afterwards, the new visibility doesn't change. Is there any other call I should make? I am using xcode 4.2 + iOS5 + AGS API 2.1.

AGSDynamicMapServiceLayer *dynLayer = (AGSDynamicMapServiceLayer *)dynamicLayerView.agsLayer; 
NSMutableArray *visLayers = [NSMutableArray arrayWithCapacity:1]; 
// add some layers into visLayers
dynLayer.visibleLayers = [[NSArray alloc] initWithArray:visLayers]; 


Thanks,
0 Kudos
1 Reply
NimeshJarecha
Esri Regular Contributor
Your code should be...

    AGSDynamicMapServiceLayer *dynLayer = (AGSDynamicMapServiceLayer *)dynamicLayerView.agsLayer; 
    NSMutableArray *visLayers = [NSMutableArray array]; 
    // add some layers into visLayers
    [visLayers addObject:[NSNumber numberWithInt:1]];
    dynLayer.visibleLayers = visLayers;


Hope this works.

Regards,
Nimesh
0 Kudos