In my iOS app (8.1). I have a UISlider which continuous property is set to YES (because I need to update labels dynamically).
My problem is that I also need to send the value picked and send it to the server. So in my case right now it does it all the time.
Can I somehow get only the last value? The value after the user releases the finger?
Any kind of help is highly appreciated.
P.S. I looked through a lot of solutions on Stackoverflow, like touchesBegan/ended, linking events in the NIB but nothing works so far.
Yu can connect multiple actions to a single control, including a slider. In addition to the one you have for "value changed", create another method hooked up to "touch up inside", and grab the slider's value in that method.
- (IBAction)dragged:(UISlider *)sender { // value changed
NSLog(@"here");
// update labels continuously here
}
- (IBAction)endedDragging:(UISlider *)sender { // touch up inside
NSLog(@"value is %f",sender.value);
//grab the final value here
}
Add a IBAction to listen ValueChanged events and uncheck UISlider's "Continuous Updates" property from Storyboard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With