我想在iPhone的启动画面中添加一些背景音乐.我已经将启动画面时间增加了几秒钟..而且音乐时间不长......但我不知道该怎么做?需要一些指导......
使用以下功能播放声音文件.
-(void)playSoundFromFileName:(NSString*)pstrFileName ofType:(NSString*)pstrFileType
{
SystemSoundID bell;
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:pstrFileName ofType:pstrFileType]], &bell);
AudioServicesPlaySystemSound (bell);
}
Run Code Online (Sandbox Code Playgroud)
在应用程序委托中调用此函数didfinishlaunchingwithoptions方法...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
[self playSoundFromFileName:@"yourfile" ofType:@"extension"];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1263 次 |
| 最近记录: |