我正在使用调用方法的UIButton播放音频剪辑(请参阅下面的代码)。我试图弄清楚如何编写一个语句来检测音频是否正在运行,如果音频文件正在播放,则禁用/隐藏UIButton。检测音频文件是否正在播放 - iphone
此刻如果您持续触摸音频剪辑播放的多个实例的播放按钮。
-(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];
}
感谢您的帮助
你调用方法[自audioMethod:自我]。 ? – 2011-07-14 00:40:44