更改AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)的持续时间 [英] Change the duration of AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
本文介绍了更改AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)的持续时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
如何选择振动的持续时间?
How can I choose the duration of the vibration?
我只想要一个短暂的震动,就像敲击键盘按钮的点击。
I want only one short vibration, like the "click" from tapping a keyboard button.
推荐答案
如文章,并在此主题,有一种方法可以调整振动的持续时间,默认为0.4秒的振动和0.1秒的静音。
As explained in this article and in this topic, there is a way to adjust the time duration of the vibration, which by default is 0.4 seconds of vibration and 0.1 seconds of silence.
for (int i = 1; i < 60; i++) {
[self performSelector:@selector(vibe:) withObject:self afterDelay:i *.3f];
}
选择器:
-(void)vibe:(id)sender {
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}
这篇关于更改AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)的持续时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文