I am trying use various NSTimers in conjunction with a pan gesture, firing them only when the translation in view reaches a certain point in the view, and invalidating the timers when they go beyond a certain point. However, I found that even if I fire the timers within the .Changed state, the gesture method itself is called continuously as the user pans. As such, the NSTimer is fired continuously and is not working as it should. Is the only option to move the NSTimers outside the pan gesture? Or is there another solution? Thanks.
Best How To :
the gesture method itself is called continuously as the user pans
This is correct behavior. It is up to you to deal with the gesture recognizer action method being called many times. You can and should distinguish why the action method is being called, by examining the gesture recognizer's
state. It will be called once for the Begin state, many times for the Changed state, and one last time for the Ended state. Any gesture recognizer action method must take account of this and structure itself accordingly, usually as one big