调用系统提示音教程
来源:互联网 发布:linux ntp客户端配置 编辑:程序博客网 时间:2024/05/18 21:40
论坛会员zhaoxy2850分享的关于调用系统提示音的教程,写的很详细
目前做的一个项目里用到了提示音,但是又不想添加提示音到库里,便开始研究调用系统自带的提示音,最后终于找到了。
开始在CC上查发现好像很多人都在问,但没人回答,我就把自己查到的东西和写的一个demo给大家分享下吧~
首先要在工程里加入Audio Toolbox framework这个库,然后在需要调用的文件里#import <AudioToolbox/AudioToolbox.h>
最后在需要播放提示音的地方写上
AudioServicesPlaySystemSound(1106);
注:括号中为系统声音的id,详见最下面的列表。
为了方便大家测试系统声音,我写了一个demo供大家使用下载。
另外,如果想用自己的音频文件创建系统声音来播放的同学可以参考如下代码。
//Get the filename of the sound file:
NSString *path = [NSString stringWithFormat:@"%@%@", [[NSBundle mainBundle] resourcePath], @"/jad0007a.wav"];
//declare a system sound
id SystemSoundID soundID;
//Get a URL for the sound file
NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
//Use audio sevices to create the sound
AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
//Use audio services to play the sound
AudioServicesPlaySystemSound(soundID);
顺便附上系统提示音对应的列表
http://iphonedevwiki.net/index.php/AudioServices
希望能对大家有帮助吧~
http://www.cocoachina.com/bbs/job.php?action=download&aid=30581
- 调用系统提示音教程
- 调用系统提示音教程
- iphone之调用系统提示音教程
- ios 调用系统提示音教程
- ios调用系统提示音教程
- iPhone之调用系统提示音教程
- ios 调用系统提示音教程
- ios 调用系统提示音教程
- 调用系统提示音
- 调用系统提示音
- iOS开发 调用系统的震动和提示音
- linux-0.11调试教程,系统调用sys_write的调用过程
- android 调用支付宝充值,提示系统繁忙,4000
- Android Notification 手机系统横幅弹出提示框调用
- 系统提示音代表什么
- note3 设置系统提示音
- iOS播放系统提示音
- 系统提示音的使用
- 键盘上各键位所对应的ASCII码详单(键盘键位表)
- “串行”为什么会走红?
- gcc中-pthread和-lpthread的区别
- 深入理解java的finalize
- 彻底搞定C指针-函数名与函数指针
- 调用系统提示音教程
- SQL Server 查询时NULL值问题
- SQL Server2005杂谈(3):四个排名函数(row_number、rank、dense_rank和ntile)的比较
- IPHONE 获得类名或 属性列
- 诊断索引健全性的新工具
- 关于软件的生命周期
- 程序性能分析-使用vs2008的分析工具
- SQL日志问题数据库 'xxx' 的日志已满
- wcf跨域调用xml