Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: Detect if touchEnded comes from sliding off screen or lifting finger?

Tags:

ios

touch

In iOS is there any way to tell, when the touch ends, if it ended by sliding off the screen or if the user lifted his finger?

I don't know why, but I expected the touch to be cancelled when this happened, but it is not.

Thanks.

like image 572
Rakka Rage Avatar asked Jun 15 '12 15:06

Rakka Rage


2 Answers

This is standard iOS behavior, you may see it in any Apple's app.

You may check if touch ended at the end of screen and treat it as "cancel sliding", but user might be wanting to slide this far.

My advice is accept it, because, as I said before, it's standard behavior, and Apple tells us to stick to it - users expect standard behavior.

like image 130
Protheus Avatar answered Nov 15 '22 09:11

Protheus


Only through deduction. If the finger was moving towards the edge of the screen and then the touch ends near that edge, you can be relatively certain that the finger indeed slid off the screen. If it wasn't moving immediately before the touch ended, the user probably just lifted their finger.

like image 40
Ole Begemann Avatar answered Nov 15 '22 08:11

Ole Begemann