muZZkat/NMRangeSlider

Applying custom image/color to trackBackgroundImage.(Track goes missing)

Opened this issue · 2 comments

Hello,

I am trying to add a color to trackBackgroundImage and trackImage

I did it this way

// UIColor *trackColor = UNIVERSALPINK;
//
// UIGraphicsBeginImageContextWithOptions(m_Slider.trackImage.size, NO, m_Slider.trackImage.scale);
// CGContextRef context = UIGraphicsGetCurrentContext();
// [trackColor setFill];
// CGContextTranslateCTM(context, 0, m_Slider.trackImage.size.height);
// CGContextScaleCTM(context, 1.0, -1.0);
// CGContextClipToMask(context, CGRectMake(0, 0, m_Slider.trackImage.size.width, m_Slider.trackImage.size.height), [m_Slider.trackImage CGImage]);
// CGContextFillRect(context, CGRectMake(0, 0, m_Slider.trackImage.size.width, m_Slider.trackImage.size.height));
//
// UIImage *coloredImg = UIGraphicsGetImageFromCurrentImageContext();
//
// UIGraphicsEndImageContext();
//
// m_Slider.trackImage = coloredImg;

This worked perfectly for trackImage, But this is not working for trackBackgroundImage.

Also I tried adding image to trackBackgroundImage. But that too didnt work.

If I apply color or image to trackBackgroundImage, the track goes missing.

Hello @muZZkat can you please have a look.

Regards
Ranjit

Same problem here? Anything new or this project is abandoned?

I found a solution.
Need to edit the layoutSubviews method in NMRangeSlider.m, adding this line self.trackBackground.image = [self trackBackgroundImage]; just after self.trackBackground.frame = [self trackBackgroundRect];