简体   繁体   中英

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

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM