导入:#import <AudioToolbox/AudioToolbox.h>
在需要出发震动的地方写上代码:
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);//默认震动效果
如果想要其他震动效果,可参考:
// 普通短震,3D Touch 中 Pop 震动反馈
AudioServicesPlaySystemSound(1520);
// 普通短震,3D Touch 中 Peek 震动反馈
AudioServicesPlaySystemSound(1519);
// 连续三次短震
AudioServicesPlaySystemSound(1521);
作者:程序圜
链接:https://www.jianshu.com/p/064c225efb0f
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
网友评论