开发者

Programmatically make the iPhone vibrate [duplicate]

开发者 https://www.devze.com 2022-12-16 11:03 出处:网络
This question already has answers here: Closed 10 years ago. Possible Duplicate: Making the iPhone vibrate
This question already has answers here: Closed 10 years ago.

Possible Duplicate:

Making the iPhone vibrate

How can yo开发者_C百科u programmatically make the iPhone vibrate?

Any ideas, or tutorial links appreciated.


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>


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
0

精彩评论

暂无评论...
验证码 换一张
取 消