Programmatically make the iPhone vibrate [duplicate]

大憨熊 提交于 2019-12-03 03:37:52

问题


Possible Duplicate:
Making the iPhone vibrate

How can you programmatically make the iPhone vibrate?

Any ideas, or tutorial links appreciated.


回答1:


You can use

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); 

Note that you need to add the AudioToolbox framework and import the following header file:

#import <AudioToolbox/AudioServices.h>



回答2:


To clarify the add(ing) the AudioToolbox framework portion of this answer:

  1. click the project from Project Navigator
  2. click the target from the left-hand navigator
  3. click Build Phases section at the top
  4. expand the Link Binary With Libraries section
  5. click little + (plus) sign
  6. type AudioToolbox.framework
  7. click Add


来源:https://stackoverflow.com/questions/2080442/programmatically-make-the-iphone-vibrate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!