读书人

AVAudioPlayer 施用小示例

发布时间: 2012-09-12 09:21:30 作者: rapoo

AVAudioPlayer 应用小示例

NSString *soundPath=[[NSBundle mainBundle] pathForResource:NSLocalizedStringFromTable([_dictionary objectForKey:@"sound"],[defaults stringForKey:@"language"],@"提示") ofType:@"mp3"];
??NSURL *soundUrl=[NSURL fileURLWithPath:soundPath];
??_player=[[AVAudioPlayer alloc] initWithContentsOfURL:soundUrl error:nil];

?

NSString *soundPath=[[NSBundle mainBundle] pathForResource:@"sound" ofType:@"mp3"];
??NSURL *soundUrl=[NSURL fileURLWithPath:soundPath];
??_player=[[AVAudioPlayer alloc] initWithContentsOfURL:soundUrl error:nil];

读书人网 >移动开发

热点推荐