iPhone有内置蜂鸣音效吗
嗨,我需要在 iPhone 上使用蜂鸣声,但我发现的唯一一件事是
NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"alert" ofType:@"wav"];
SystemSoundID soundID;
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath: soundPath], &soundID);
AudioServicesPlaySystemSound (soundID);
[soundPath release];
它可以工作并且代码良好,但我需要导入alert.wav 文件。但我宁愿使用本机(内置)声音(如果存在)来执行此操作。
感谢所有的答案 CS。
hi i need to use beep on iphone, but the only thing i have found is this
NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"alert" ofType:@"wav"];
SystemSoundID soundID;
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath: soundPath], &soundID);
AudioServicesPlaySystemSound (soundID);
[soundPath release];
it is working and good code but i need to import the alert.wav file.But i rather do this with native (built in) sounds if there exist.
thanks for all the answers
cs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
阅读Apple的文档和这个,我几乎可以肯定你可以播放想要的声音,而无需携带它。
您可以这样做:
AudioServicesPlaySystemSound(1005);
应该可以。
参考:此处
Reading the documentation of Apple and this, I'm almost certain that you can play that wanted sound without carrying it.
You can do this:
AudioServicesPlaySystemSound(1005);
that should do.
Reference: here