XCode iOS UISlider - Custom Scaling Min and Max - ios

I want to have a different scale using a slider for the Min and Max. 0 should be in the middle, but I want to have a scale 0-50 for max and -200-0 for min.
Is that possible? How could I achieve that?

I don't think that this is possible out of the box.
But what you can do is, e.g. setup the slider in a way that for min it has 0 and for max 1000. Now you will have to check in which part of the part, user left the slider. If it's in the lower half, you will have to normalize those values to the desired range, the same for the upper range. The exact middle could be a bit tricky because you will have more points in the slider than in the ranges you are providing, but I guess with some fiddling around you can do this. :)
Hope that helped :)

I believe this is quite possible.
Here is my idea of how you can do it
Take a slider with values -200 to 200
For values > 0. Divide value by 4. (i.e. 200 / 4 = 50)
This will make your positive range from 0 to 50 but negative range from -200 to 0
Similarly while setting value to slider in positive manner you can multiply it by 4.

Related

How to set min and max values for an axis?

I have some data that can have values in the range (0..100). Highcharts will sometimes label the axis from -10 to 110, which looks odd.
How can I prevent this? I can set a fixed min and max value for the axis, but if the current values happen to be between e.g. (50..60), I'd rather let Highcharts zoom in on the axis accordingly. Just don't want Highcharts to ever show anything outside of (0..100).
I could of course determine the appropriate min and max values myself every time I load data, but was hoping there would be some kind of minMin and maxMax setting?
So it looks like this isn't possible; opened a feature request.
Nowadays highcharts has floor and ceiling options for this use case.

How to give Padding before slider value 0 and after slider value 100 in custom UISlider

I need a custom slider something like below
I need to start my slider after some padding, and need same padding after slider reaches end i.e;slider value 100, by filling same maximum and minimum track image of slider even in this padding area as shown in the above image.
In other words Slider has to start virtually after some padding and end before some padding value.
How to achieve this? any help is appreciated in advance.
The key is to provide a mapping function that converts a value to a slider setting, and vice versa. Thus you never use the slider value directly, only the mapped value.
You set the left value to -10 and the right to 110. The mapping f returns 0 for values <= 0, 100 for >= 100, and the real value for ant thing else.

linear Dataseries Say 0 on Y Axis Having Issue

Linear Dataseries Say all y axis is 0, Autoscaling on y axis is not working as desired.
High stock version - 1.3.1
DataSeries to be plotted,
[[1149724800000,0],[1149811200000,0],[1150070400000,0],[1150156800000,0],[1150243200000,0],[1150329600000,0],[1150416000000,0],[1150675200000,0],[1150761600000,0],[1150848000000,0],[1150934400000,0],[1151020800000,0],[1151280000000,0],[1151366400000,0],[1151452800000,0],[1151539200000,0],[1151625600000,0]]
OR
[[1149724800000,20],[1149811200000,20],[1150070400000,20],[1150156800000,20],[1150243200000,20],[1150329600000,20],[1150416000000,20],[1150675200000,20],[1150761600000,20],[1150848000000,20],[1150934400000,20],[1151020800000,20],[1151280000000,20],[1151366400000,20],[1151452800000,20],[1151539200000,20],[1151625600000,20]]
Try Above series with Y min set to 0 and Y Min to Auto.
I had the same issue with 0 values displayed in the center.
The only way I found to get round it was to either use tickPositions and pass range values across to it for the data based of min/max values and ones in between or to use the tickPositioner call back function to return to go through the data and return the tick values based on these.
Still fairly new to highcharts so there is probably another way I don't know of. If anyone knows how to have 0 values displayed at the bottom of the chart while it auto-scales then please post as I would love to know how/if its possible.
Edit: turns out this isn't really possible currently, only way to get around it is to set min/max values and that won't allow auto scaling but at least it stop there from being any middle 0 values.

Problem with a vertical UISlider with custom images

So i have a custom UISlider. It's vertical (i did it with the +270° technic). I have 3 images, respectively for the minimum value, maximum value and for the thumb. Everything seems good but i have problems with the extrema values, as you can observe on the screen capture (even though it's a little dark).
The slider on the left is perfect ! Both end of the sliders show the images perfectly and the cursor (thumb) is perfectly cutting the slider in 2.
The other two sliders on the right shows a similar issue. We can see that, when in extrema value, the cursor is not well located (there shouldn't be any part of the image below or above the middle of the cursor !) Oo
More to that, let's look at the right slider (with minimum value). We can see that image has been cut on the bottom ! Indeed it should be close. It's the same thing for the maximum value, the image looks like it's been cut.
I looked at the bounds of the slider view by touching it at both ends and looking at its coordinates. The slider was defined with a height of 300 but i can perform touches at coordinate 307, or -6 !!! I don't really understand why..
For more information, coordinates form 300 to 310 represents the maximum value i defined and negative coordinates (from 0 to -10) represents the minimum value.
-> So We can notice there's a difference of 10 at both ends.
Please help ! :s

how to position thumb of Slider according to preferred duration in iOS

I have a custom slider whose min and max values are 0 and 1 respectively.
I want to set the thumb at a particular duration(at 1s) of the file. How do I do that calculation? Currently, I'm multiplying the slider value with the total duration of file to get the desired position.
But, now depending on my preference, how do I set the thumb?
Please advise.
The easiest thing would be to set the max value of the slider to the length of your file. It's a settable property, so just
slider.maximumValue = fileDuration;
would work. Then, you can just set the value for however long into the file you want.
If you can't do that for other reasons, you need to normalize the position you want by the file length (that is, divide the position you want by the file duration to find the value):
slider.value = (desiredPosition / fileDuration);
Note that with this, if desiredPosition is the entire length of the file, you get 1 (the maximum value of the slider by default)

Resources