I’m using muZZkat’s custom range slider: NMRangeSlider@github1
But i need to fade the slider. When i create the range slider, i put it into a content view. I’ve tried setting the alpha of the content view to .7
UIView *sliderView = [self configureLabelSliderWithSize:CGSizeMake(300, 70)];
sliderView.alpha = .4;
but it does not give the desired effect:

The UIImageView upperHandle and lowerHandle also fade out which shows the background track (the blue part). I’d rather have the handle’s alpha be higher so you can’t see the blue part behind it.
I tried adding a method to the ranger slider class:
-(void)toggleAlpha {
self.trackBackground.alpha = .3;
self.track.alpha = .3;
self.lowerHandle.alpha = .3;
self.upperHandle.alpha = .3;
}
but this does not change the alpha at all.
The UIImageViews are all initalized in the -(void)addSubviews method:
- (void) addSubviews
{
//------------------------------
// Track Brackground
self.trackBackground = [[UIImageView alloc] initWithImage:self.trackBackgroundImage];
self.trackBackground.frame = [self trackBackgroundRect];
//------------------------------
// Track
self.track = [[UIImageView alloc] initWithImage:self.trackImage];
self.track.frame = [self trackRect];
//------------------------------
// Lower Handle Handle
self.lowerHandle = [[UIImageView alloc] initWithImage:self.lowerHandleImageNormal highlightedImage:self.lowerHandleImageHighlighted];
self.lowerHandle.frame = [self thumbRectForValue:_lowerValue image:self.lowerHandleImageNormal];
//------------------------------
// Upper Handle Handle
self.upperHandle = [[UIImageView alloc] initWithImage:self.upperHandleImageNormal highlightedImage:self.upperHandleImageHighlighted];
self.upperHandle.frame = [self thumbRectForValue:_upperValue image:self.upperHandleImageNormal];
[self addSubview:self.trackBackground];
[self addSubview:self.track];
[self addSubview:self.lowerHandle];
[self addSubview:self.upperHandle];
}
and if i set their alpha lower here, it works.
I don’t understand why i can’t alter the alpha from anywhere else?
I just added the NMRangeSlider-Demo and checked it out.
I think the problem is that you’re probably calling toggleAlpha in viewDidLoad method, right?
You should instead call in the viewDidAppear method, since layoutSubviews method (which in turn calls addSubview) in the NMRangeSlider class, is called after viewDidLoad and before viewDidAppear, so whatever you do in viewDidLoad will be reset as the subviews are initialized in addSubview method.
Just adding toggleAlpha in viewDidAppear worked for me.