NMRangeSlider icon indicating copy to clipboard operation
NMRangeSlider copied to clipboard

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

Open ranjitk-plackal opened this issue 9 years ago • 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

ranjitk-plackal avatar Apr 22 '15 13:04 ranjitk-plackal

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

WedgeSparda avatar Sep 02 '15 11:09 WedgeSparda

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];

WedgeSparda avatar Sep 02 '15 12:09 WedgeSparda