0
我在桌子視圖單元格上放置了一個按鈕,當它們被按下時播放聲音,當我按下它停止聲音時。但按另一個單元格上的另一個按鈕時,它不會播放另一個聲音,而另一個仍在播放。我希望當另一個表格單元格中的另一個按鈕被按下時,它將停止播放聲音。我把一個按鈕放在表格視圖單元格上,當它們被按下時播放聲音,但
這裏是我的代碼
.h文件中
我進入這個上@interface支架AVAudioPlayer * talkSound;
.M
NSString *myExamplePath = [[NSBundle mainBundle] pathForResource:@"kumusta" ofType:@"m4a"];
if (talkSound.playing) {
[talkSound stop];
[talkSound release];
}
talkSound =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:myExamplePath] error:NULL];
talkSound.delegate = self; /*with this here it says theres no delegate so i go an add AVAudioPlayerDelegate and i get tons of errors of connot find protocol declaration*/
[talkSound play];