NMRangeSlider icon indicating copy to clipboard operation
NMRangeSlider copied to clipboard

Range slider - minimum value not working if set to different value but 0

Open teffi opened this issue 10 years ago • 10 comments

I'm trying to specify a range 18-60.

  • (void) configureAgeSlider { age_slider.minimumValue = 18; age_slider.maximumValue = 60; age_slider.lowerValue = 18; age_slider.upperValue = 60; age_slider.minimumRange = 10; }

Things didn't went the way it supposed to.

At first this happened. The view width I placed on xib is the ideal with I want the slider to have but after running the slider exceeded the the view.

1

I tried decreasing the width and so it fit. As you can notice instead of 18 as the minimum value it is stuck to 1 and I can't even drag it.

2

The maximum value is fine and thus can be dragged up to the minimum value I set which is 18. 3 )

Can someone fix it or does this library only really works for 0 -100 range

teffi avatar Oct 13 '14 09:10 teffi

I have a bug in the slider that i haven't fixed yet, in your code just set the upper value first, then the lower value, its just in the configure slider method and everything will be sweet.

muZZkat avatar Oct 13 '14 09:10 muZZkat

Its just some of the range checking in the code needs to be fixed up.

muZZkat avatar Oct 13 '14 09:10 muZZkat

Thanks! Maybe you could indicate it on the wiki for future users of this library.

Another minor issue btw, seems like on iOS8 UIlabel flickers back to the original position while dragging the slider. Any idea why?

teffi avatar Oct 13 '14 10:10 teffi

i was scratching my head for ages until i found this :) thanks putting the upper value first did make the difference

ninjr avatar Oct 13 '14 22:10 ninjr

@teffi the flickering happens because you have AutoLayout turned on for that viewcontroller. I had the same issue. Select the viewcontroller, tick off autolayout and it works.

ejsing avatar Oct 17 '14 13:10 ejsing

It's insane to design a screen without using AutoLayout for iPhone 4/5/6 screens.

agordeev avatar Nov 24 '14 14:11 agordeev

The control was designed before auto layout was really a thing. Feel free to add support and submit a pull request. I currently don't use it in any active projects at the moment so not sure when I would get a chance to look at it.

muZZkat avatar Nov 24 '14 14:11 muZZkat

Whew. Glad I read this. Definitely need to include this in the README.

JinkProject avatar Nov 24 '14 22:11 JinkProject

Oh dang! Thought I was going crazy. Agreed, this should be in README. Awesome slider, though!

tnahvu avatar May 20 '15 06:05 tnahvu

@teffi If you want to use it in auto layout please set "setTranslatesAutoresizingMaskIntoConstraints:" Yes for your label. It will fix that flicker issue.

rajeeshkumar avatar Sep 15 '15 08:09 rajeeshkumar