seemefly163_0 发表于 2013-1-14 21:15:12

iPhone播放声音

 
NSURL *path = [ URLForResource:@"teaSound" withExtension:@"m4r"];SystemSoundID soundID;AudioServicesCreateSystemSoundID((CFURLRef)path, &soundID);AudioServicesPlaySystemSound(soundID); 代码就是上面几句,另外要添加AudioToolbox.framework
 
头文件中要
#import <AudioToolbox/AudioToolbox.h>
 
声音文件30秒内的 aif wav m4r caf。
页: [1]
查看完整版本: iPhone播放声音