可能重复:
自动重复播放
我怎样才能循环播放声音(我的背景音乐)
这是我的代码:
NSString *path = [[NSBundle mainBundle] pathForResource:@"MathMusic" ofType:@"aif"];
AVAudioPlayer* theAudio= [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
theAudio.delegate = self;
[theAudio play];
Run Code Online (Sandbox Code Playgroud)
如何让它继续进行,如果我循环它还会在下一个(或另一个)视图中播放?