I'm playing an audio clip using a UIButton that calls a method (see code below). I'm trying to figure out how to write a statement to detect if the audio is running, and if the audio file is playing then disable/hide the UIButton.
At the moment if you keep touching the play button multiple instances of the audio clip play.
-(void) audioMethod {
NSString *path = [[NSBundle mainBundle] pathForResource:@"affs" ofType:@"mp3"];
theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
theAudio.delegate=self;
theAudio.numberOfLoops = -1;
[theAudio prepareToPlay];
[theAudio play];
}
thanks for any help