how can use vibrate when iPhone shaking ? here is my code :
#pragma mark -
- (void)accelerometer:(UIAccelerometer *)acceleromete开发者_C百科r
didAccelerate:(UIAcceleration *)acceleration {
{
if (acceleration.x > kAccelerationThreshold
|| acceleration.y > kAccelerationThreshold
|| acceleration.z > kAccelerationThreshold) {
**//Vibrate it !**
}
}
}
You can do:
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
Make sure to add the AudioToolbox framework.
精彩评论