wadda_wadda
wadda_wadda

Reputation: 1004

Preventing UIGestureRecognizer from Detecting Input

I would like to set up a pan gesture that can only perform its action ONCE per 0.4 seconds.

Is the preferred manner of doing this to use NSTimer or CACurrentMediaTime, and is either one of these an "accurate" timer?

Upvotes: 0

Views: 38

Answers (1)

matt
matt

Reputation: 535121

Neither. Simply record (in a property) the current time when you perform the gesture. Now, the next time the gesture recognizer fires, compare the current time with the recorded time; if they are too close together, return and do nothing.

Upvotes: 2

Related Questions