Select to view content in your preferred language

AGSTiledMapServiceLayer Alpha [SOLVED]

598
1
08-06-2010 02:49 PM
MarcoBrugna
Deactivated User
Hi,
is there a way to set the layer transparency?

Thanks
Marco


[SOLUTION]
AGSTiledLayerView  *basemapView = [self.mapView.mapLayerViews objectForKey:@"layerName"];
   basemapView.alpha = alpha;
0 Kudos
1 Reply
JeffPapirtis
Occasional Contributor
You can also use a Slider to adjust the Transparency (alpha level).


in your .h file create a Slider IBOutlet and IBAction to adjust your values.

IBOutlet UISlider *sliderBaseMap;

@property(nonatomic, retian) IBOutlet UISlider *sliderBaseMap;

-(IBAction)baseMapAlpha:(id)sender;

in your .m file add the code to create the transparency:

@synthesize sliderBaseMap;

-(IBAction)baseMapAlpha{
baseMap.alpha = sliderBaseMap.value;
}

Also if you want the initial value to be something other than 1 in your viewDidLoad method use the following to define the initial state of transparency.

self.baseMap.alpha = .5;

In Interface builder, connect the Slider Outlet sliderBaseMap to the slider bar.
Next connect the IBAction (baseMapAlpha) to the same slider bar.

You can adjust the settings such as what the initial value is, or if the value should update continuously or after the user has lifted their finger off of the slider to update.

Hope this helps!
0 Kudos