Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UISlider problem - how to detect a user releasing the slider button in iOS?

Tags:

ios

iphone

ipad

I can detect the value change event from the UISlider, but now I need to detect a user releasing the slider button.

How to detect this event (or touch on slider ends) ?

Should I use the "touch up inside" event for detection ?

Thanks.

like image 886
user403015 Avatar asked May 25 '11 13:05

user403015


2 Answers

You can also use the UISlider's UIControlEventValueChanged. Set the continuous property to NO as to initiate when the user is done selecting a value.

[mySlider addTarget:self action:@selector(myMethod) forControlEvents:UIControlEventValueChanged];
mySlider.continuous = NO;
like image 119
sangony Avatar answered Sep 22 '22 13:09

sangony


I've not worked with sliders, however as UISlider inherits from UIView - surely you can just tap into touchesBegan: and touchesEnded: to perform your task.

like image 25
Luke Avatar answered Sep 21 '22 13:09

Luke