我的应用程序需要几秒钟才能加载,并且我有一个启动画面。一旦“viewDidLoad”我有一点声音播放。我觉得如果在启动画面弹出时开始播放声音会更好。在启动画面之前/期间是否可以有声音开始?
这是我的代码:(在 viewDidLoad 下)
NSString *soundFilePath = [[NSBundle mainBundle] pathForResource: @"intorSound" ofType: @"aif"];
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath: soundFilePath];
player = [[AVAudioPlayer alloc] initWithContentsOfURL: fileURL error: nil];
[player setVolume: soundVolumeValue]; // available range is 0.0 through 1.0
[player play];
[fileURL release];
感谢您的时间!