Is anyone aware of a version of the iPhone UISlider control with two thumbs? I need a control that will allow specifying a range of values. The UISlider API docs would imply this isn't possible with the standard control, so I was wondering if anyone had a solution for this (or had solved it themselves).
Here's a range slider I just cooked up
http://github.com/cmezak/CMRangeSlider
If you're still interested this is my implementation. I'm making it well documented so everyone could start using it with ease.
https://github.com/fcy/fancy-ios/tree/master/src/ui/range-slider
It works with iOS 5+
I had this problem too. The way I solved it was a bit of a hack but simpler for noobs like me!
I put two sliders on top of eachother. Made the track of one invisible using a transparent .png file. Then created a sliderReleased: method that I linked to the touch up inside event in interface builder that switches the userInteractionEnabled: state of each slider.
It means that you can only set one slider at a time and you have to touch one before you can set the other but for my purposes it does the job.
I linked both sliders' touch up inside to this method and set tags to 1 and 2 and linked the value changed event to individual methods like normal.
-(IBAction) onReleaseBP: (id) sender {
if ([sender tag]==1) {
[diastolicSld setUserInteractionEnabled:NO];
[systolicSld setUserInteractionEnabled:YES];
}
else {
[systolicSld setUserInteractionEnabled:NO];
[diastolicSld setUserInteractionEnabled:YES];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With