停止聲音我使用下面的代碼來播放聲音如何在按下一個按鈕
NSString *laughSoundPath = [[NSBundle mainBundle]pathForResource:@"laugh" ofType:@"wav"];
NSURL *laughURL = [[NSURL alloc]initFileURLWithPath:laughSoundPath];
laughTone = [[AVAudioPlayer alloc]initWithContentsOfURL:laughURL error:nil];
[laughTone prepareToPlay];
[laughTone setDelegate:self];
[laughURL release];
-(IBAction)play
{
[laughTone play];
}
我使用下面的行停止聲音
-(IBAction)stop
{
[laughTone stop];
}
問題是..當我再次播放聲音,它從停止的地方開始..我的意思是說它的工作暫停..幫我出去
都能跟得上它不工作 – Shreedhar 2012-02-22 06:14:34
@Shreedhar:好的編輯試試吧。 – Dair 2012-02-22 06:20:45