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:)
Sounds like a bug, try to workaround this by calling
[slider sendActionsForControlEvents:UIControlEventValueChanged];
right after you set the value programmatically.
精彩评论