iOS 播放系统声音&系统声音大全

在app开发中使用系统音效有震动,声音类。

设置方法如下

步骤1 添加所需库文件,即“AudioToolbox.framework

步骤2 在使用类中添加头文件,即

#import <AudioToolbox/AudioToolbox.h>

步骤3 使用

3-0 定义

SystemSoundID soundID;
3-1 震动 

soundID = kSystemSoundID_Vibrate;
AudioServicesPlaySystemSound(soundID)

3-2 系统声音播放

soundID = 1000;
AudioServicesPlaySystemSound(soundID)

3-3 系统声音停止

AudioServicesRemoveSystemSoundCompletion(soundID);


其中audioID就是你需要打开系统声音的id号:附上系统对应提示音对照表:

There are some predefined system sounds, for the system sound ID in the range 1000 to 2000 (decimal), as shown below (from 2.0 to 5.0 beta). The system sounds are all stored in/System/Library/Audio/UISounds/.


Sound ID File name (iPhone) File name (iPod Touch) Category Note
1000 new-mail.caf new-mail.caf MailReceived 收到邮件
1001 mail-sent.caf mail-sent.caf MailSent 发送邮件
1002 Voicemail.caf Voicemail.caf VoicemailReceived 收到语音邮件
1003 ReceivedMessage.caf ReceivedMessage.caf SMSReceived 收到短信
1004 SentMessage.caf SentMessage.caf SMSSent 发送短信
1005 alarm.caf sq_alarm.caf CalendarAlert 日历提醒
1006 low_power.caf low_power.caf LowPower 电量低
1007 sms-received1.caf sms-received1.caf SMSReceived_Alert 收到短信警报
1008 sms-received2.caf sms-received2.caf SMSReceived_Alert
1009 sms-received3.caf sms-received3.caf SMSReceived_Alert
1010 sms-received4.caf sms-received4.caf SMSReceived_Alert
1011 - - SMSReceived_Vibrate 收到短信震动
1012 sms-received1.caf sms-received1.caf SMSReceived_Alert
1013 sms-received5.caf sms-received5.caf SMSReceived_Alert
1014 sms-received6.caf sms-received6.caf SMSReceived_Alert
1015 Voicemail.caf Voicemail.caf - Available since 2.1
1016 tweet_sent.caf tweet_sent.caf SMSSent Available since 5.0
1020 Anticipate.caf Anticipate.caf SMSReceived_Alert Available since 4.2
1021 Bloom.caf Bloom.caf SMSReceived_Alert Available since 4.2
1022
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

番薯大佬

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值