Search code examples
iosslidertitaniumappceleratortitanium-mobile

Prevent the user from changing the slider value manually : Titanium


I'm creating an ios application in which the window contains a slider. I'm using the slider for displaying a particular value that has already set, i.e. the user should not change the value manually. I've created the slider as follows

var slider = Ti.UI.createSlider({
    min : 0,
    max : 60,
    width : '60%',
    height: 40,
    value : 25,
    enabled : false,
    disabledLeftTrackImage : 'slider.png'
});

Here the user in not able to change the slider value because I have set enabled : false. But when I do so, the image get blurred(slider 2 in the image). I want it like the first one and user should not change the slider value manually. Is it possible to do? Is there any other method to prevent the user from changing the slider value? Can anyone help me?

Slider Image


Solution

  • Mr.Jack's answer worked fine for me. But I got more Simple way from here. By resetting the touchEnabled property like touchEnabled : false. I'm adding it here as answer because it will be helpful for someone else!!

    var slider = Ti.UI.createSlider({
            min : 0,
            max : 60,
            width : '60%',
            height: 40,
            value : 25,
            touchEnabeld : false,
            leftTrackImage : 'slider.png'
    });