Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ranjitk-plackal opened this issue Apr 22, 2015 · 2 comments

Comments

@ranjitk-plackal
Copy link

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

@WedgeSparda
Copy link

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

@WedgeSparda
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants