How can I break from a method prematurely that's being called by NSTimer
Posted
by jammur
on Stack Overflow
See other posts from Stack Overflow
or by jammur
Published on 2010-05-07T22:40:05Z
Indexed on
2010/05/07
22:48 UTC
Read the original article
Hit count: 327
Basically I'm writing a metronome app, but I'm using a sound file that, depending on the BPM, might not be finished playing when the "play" method is called again. For example, if the sound file is 0.5 seconds long, but the BPM is 200, the "play" method needs to be called every 0.3 seconds.
I'm not overly familiar with NSTimer, but it appears that if it is supposed to fire before the previous invocation has completed, it doesn't, and just waits for the next time around. I could be completely wrong about that though.
What I need to do is have the previous invocation end prematurely, and have the "play" method called again when the time is supposed to fire.
Any help would be appreciated!
© Stack Overflow or respective owner