问题
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:
- click the project from Project Navigator
- click the target from the left-hand navigator
- click Build Phases section at the top
- expand the Link Binary With Libraries section
- click little + (plus) sign
- type
AudioToolbox.framework
- click Add
来源:https://stackoverflow.com/questions/2080442/programmatically-make-the-iphone-vibrate