iphone 调用系统铃声与震动功能

最近搞移动IPHONE项目,记录一下,闲话少话,直接上代码。

首先要在工程里加入Audio Toolbox framework这个库,然后在需要调用的文件里

#import <AudioToolbox/AudioToolbox.h>

最后在需要播放提示音的地方编写如下代码:

AudioServicesPlaySystemSound(1000);//新邮件消息提示

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); //震动

 

注:括号中为系统声音的id,详见请参考以下网址http://iphonedevwiki.net/index.php/AudioServices。

 

你可能感兴趣的:(iPhone)