Touch debouncing on iPod / iPad

Is it common practice to have some kind of debouncing / refractory period for handling custom touches?

I have a view-based application with a fairly large number of user interface objects that currently use touchUpInside to switch states. I notice that it is almost easy to double-tap or cyclic state more than once. Since the gameplay is relatively fast, it doesn't really matter, but I was curious if other people consider it necessary, and if so, how they implemented it. I suppose that I can record the last time of the touch and ignore the new ones for some refractory period, resetting the start time of each valid touch. It seems that something will be built into the api to facilitate this, though.

+3
source share
1 answer

This will probably depend on your application. Like any other coding, I would say do not worry about this until your testing shows that this is a problem (or close to a problem). UIGestureRecognizer gives you a lot of information about movements and gives you pretty fine control over the grain to determine what truly represents a unique event. If you find that your needs exceed them, you can use the raw touch information from the recognizer to make your own control.

0
source

Source: https://habr.com/ru/post/1760548/


All Articles