即使用户更改视图控制器等,我也想在整个应用程序中播放配乐。我有一个来自配乐的循环,我想在它完成后重复。我目前正在通过以下方式播放声音:
NSString *soundFile = [[NSBundle mainBundle]
pathForResource:@"Click03" ofType:@"wav"];
AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc]
initWithContentsOfURL:[NSURL fileURLWithPath: soundFile]
error:nil];
[audioPlayer start];
// or [audioPlayer stop];
我不太确定这是否是播放声音的最佳方式。有人可以向我解释如何做我上面问的吗?提前致谢!