There are three UIButton Events available:
UITouchUPInside
UITouchDown
UITouchDownRepeat
My problem is:
I have a button (Play-Pause). First time its shows play button, if user taps on it, it starts my process. And button image changes to Pause and tag changes to 1.
If user tap on pause button, it pauses the process and image changes to Play and tag to 0.
Now my problem is, what if user taps multiple times, its not executing properly. Like double click on desktop mouse.
I have tried all three above method, but all those times, first two methods are getting called. So how to avoid that.
If its double tap, than also process should be started once only.
Please suggest.
Edit:
Currently we are using TouchUpInside
event only, there we are checking
if (btn.tag == 0) {
// change to pause button
// start process
btn.tag = 1;
}
else if (btn.tag == 1) {
// change to play button
// stop process
btn.tag = 0;
}
But this is causing issue when user quickly taps on button. Because my process is running on thread, so it takes time to load and stop. Meanwhile use already has double tapped over button.