Setting opacity for a AGSFeatureTableLayer

3897
1
Jump to solution
02-12-2015 11:32 AM
DanShriver
New Contributor

I'm adding an AGSFeatureTableLayer that is based on an AGSGDBFeatureServiceTable. The layer shows up fine, but when I try to set the opacity I see no effect. The code is below. Could there be something with the feature service the table is loading from that would be preventing a change to opacity? Thanks.

        mc.fieldsFeatureLayer = [[AGSFeatureTableLayer alloc] initWithFeatureTable:table];

        mc.fieldsFeatureLayer.delegate = mc;

        mc.fieldsFeatureLayer.selectionColor = [UIColor redColor];

        [mc.fieldsFeatureLayer setOpacity:0.3];

        [mc.mapView insertMapLayer:mc.fieldsFeatureLayer withName:fieldBoundaryLayerName atIndex:1];

0 Kudos
1 Solution

Accepted Solutions
MengyiGuo
Occasional Contributor

I tested your code and the issue can be reproduced. I think the reason is that you need to set the opacity in the layerDidLoad method in delegate. That confirms your AGSFeatureTableLayer is loaded.

-(void)layerDidLoad:(AGSLayer *)layer{

    if([layer isKindOfClass:[AGSFeatureTableLayer class]]){

        AGSFeatureTableLayer* ftLayer = (AGSFeatureTableLayer*)layer;

        [ftLayer setOpacity:0.2];

     

    }

}

View solution in original post

0 Kudos
1 Reply
MengyiGuo
Occasional Contributor

I tested your code and the issue can be reproduced. I think the reason is that you need to set the opacity in the layerDidLoad method in delegate. That confirms your AGSFeatureTableLayer is loaded.

-(void)layerDidLoad:(AGSLayer *)layer{

    if([layer isKindOfClass:[AGSFeatureTableLayer class]]){

        AGSFeatureTableLayer* ftLayer = (AGSFeatureTableLayer*)layer;

        [ftLayer setOpacity:0.2];

     

    }

}

View solution in original post

0 Kudos