一.系統(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)默認(rèn)震動
?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];
? ? ? ? ? ? ? ? }
? ? ? ? ? ? });