0
此代碼正常工作,直到我退出視圖並嘗試返回。如果我這樣做,停止按鈕不再起作用。如何在離開視圖後讓它繼續工作?MP3播放和停止問題?
-(IBAction)musiconButtonClicked:(id)sender{
NSString *path = [[NSBundle mainBundle] pathForResource:@"NextRevIt" ofType:@"mp3"];
self.audioPlayer = [[AVAudioPlayer alloc ] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
[audioPlayer play];
}
-(IBAction)musicoffButtonClicked:(id)sender{
[audioPlayer stop];
}