dot
dot

Reputation:

How do I display an UIImageView while a sound is playing?

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?

Upvotes: 2

Views: 279

Answers (1)

John Fricker
John Fricker

Reputation: 3344

Briefly, you need to take a look at AVAudioPlayerDelegate and audioPlayerDidFinishPlaying.

Upvotes: 2

Related Questions