I’m trying to display an image while a sound is playing. I can get it to appear, but I’m having trouble making it disappear once the sound has finished playing.
My code:
-(IBAction)guitarChord:(id)sender { if (theAudio.playing == YES) { theAudio.stop; theAnimation.stop; } else { theAudio.play; theAnimation.play; } }
I’m using AVAudioPlayer.
Any ideas what I am doing wrong?
How do I detect a sound has stopped?
Briefly, you need to take a look at AVAudioPlayerDelegate and audioPlayerDidFinishPlaying.