系統(tǒng)震動or震動反饋

一.系統(tǒng)震動

1.AudioServicesPlaySystemSound()

系統(tǒng)震動是在iOS10.0之前存在的,利用AVFoundation框架

用法說明:在以后的版本中將不推薦使用此函數(shù)。使用AudioServicesPlaySystemSoundWithCompletion代替。

@function AudioServicesPlaySystemSound

播放由提供的SystemSoundID指定的聲音。

表示要播放的系統(tǒng)聲音的SystemSoundID。

@param inSystemSoundID

用于播放系統(tǒng)聲音服務(wù)器的SystemSoundID。

//系統(tǒng)默認震動

?AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

記得導(dǎo)入

#import <AVFoundation/AVFoundation.h>

?// 普通短震,3D Touch 中 Pop 震動反饋

//AudioServicesPlaySystemSound(1520);

// 普通短震,3D Touch 中 Peek 震動反饋

// AudioServicesPlaySystemSound(1519);

// 連續(xù)三次短震

//AudioServicesPlaySystemSound(1521);

SystemSoundID _soundID;

AudioServicesPlaySystemSound(_soundID);

? ? ? ? ? ? AudioServicesPlaySystemSoundWithCompletion(_soundID, ^{

? ? ? ? ? ? ? ? if(weakSelf.systemSoundToolsDelegate) {

? ? ? ? ? ? ? ? ? ? [weakSelf.systemSoundToolsDelegate playSystemSoundCompletion];

? ? ? ? ? ? ? ? }

? ? ? ? ? ? });

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容