音效的播放_01

- 使用AVfundation框架

 - (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent *)event{

NSURL *url = [[NSBundle mainBundle]URLForResource:@"buyao.caf" withExtension:nil];

SystemSoundID soundID;

//创建soundID soundI'D是Int类型

AudioServicesCreateSystemSoundID(CFBridgingRetain(url), &soundID);

//这个是主要的播放的方法

AudioServicesPlaySystemSound(soundID);

}

你可能感兴趣的:(音效的播放_01)