ios 设备震动

使得iOS设备震动有两个方法,均是传入kSystemSoundID_Vibrate常量。

AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

 

AudioServicesPlayAlertSound 方法在不支持震动的设备上(iPod)会播放一段特殊的声音。
AudioServicesPlaySystemSound 方法在不支持震动的设备上调用会保持静默。

详情可以参考System Sound Services Reference,这两者调用都只对iPhone/iPod有效,我在iPad上试试了一下,调用他们都保持静默。

转自:http://www.ohbug.com/blog/

posted @ 2014-02-10 10:40  haroel  阅读(301)  评论(0编辑  收藏  举报