views:

543

answers:

1

Hi :)

I have set my UISlider up to respond to value changed events:

    [customSlider addTarget:self action:@selector(sliderMove:) forControlEvents:UIControlEventValueChanged];
    [customSlider addTarget:self action:@selector(sliderStart:) forControlEvents:UIControlEventTouchDown];
    [customSlider addTarget:self action:@selector(sliderEnd:) forControlEvents:UIControlEventTouchUpInside];

I would like to animate the slider to the position where the user left it the last time the view was used. I do this with:

[customSlider setValue:position animated:YES];

Everything works fine, except, I have build a "tag" that hangs over the sliders "knob" so the user can see the value when moving the slider. The position of the "tag" is set when the UIControlEventValueChanged calls the "sliderMove" method.

When using the [slider setValue:position animated:YES] the slider moves, but the event does not fire.

Is there a delegate I can get to or an event that covers this scenario?

Thanks for any help given:)

A: 

Sounds like a bug, try to workaround this by calling

[slider sendActionsForControlEvents:UIControlEventValueChanged];

right after you set the value programmatically.

bddckr
Hi ChriB and Thanks:)Sending the action manually did force it to respond and behave like it should? I actually didn't think it would call delegate methods during animation.Is there a way to control the speed of the animation, like in UIAnimation, when doing [slider setValue:14 animated:YES], if I may add a question:)
RickiG
Don't think there's a way to change that. You should ask this as a new question, maybe someone else knows. :)
bddckr