forum

Home / DeveloperSection / Forums / Timer and animation events trumping TouchesEnded events

Timer and animation events trumping TouchesEnded events

Anonymous User169214-Sep-2015

I've implemented a tap-and-hold handler using an NSTimer that I first set in the TouchesBegan overload.

However, what I actually want is for an action to be continuously performed in quick-fire succession while the touch is being held. So, on timer expiry I call a handler to do the work, which then sets another timer and the cycle continues until the TouchesEnded comes in and cancels it, or another terminating condition is met.

 

This works fine, until my handler code triggers an animation to go off at the same time. Now we have animation events and timer events going off, and in all that we need to handle TouchesEnded as well.

 

Problem is that, if the animation is triggered, and I set my timer to less than 0.025 seconds, my TouchesEnded event doesn't come through until the timer cycle stops (the other terminating condition). Setting a slower timer, or not triggering the animation, make it work (TouchedEnded comes in straight away), but are not what I want.

 

Obviously this is all on the device (release build - no NSLogs) - in the sim it all works fine

 

Is there any way of setting the relative priorty of these events - or is it likely I'm missing something else obvious here?

 

[Update]

I've worked around this in this instance by doing the continuous part without visual feedback until it's done (which from this users perspective is instant). I think this is ok for now.


Updated on 15-Sep-2015
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By