Reputation: 4994
how can use vibrate when iPhone shaking ? here is my code :
#pragma mark -
- (void)accelerometer:(UIAccelerometer *)accelerometer
didAccelerate:(UIAcceleration *)acceleration {
{
if (acceleration.x > kAccelerationThreshold
|| acceleration.y > kAccelerationThreshold
|| acceleration.z > kAccelerationThreshold) {
**//Vibrate it !**
}
}
}
Upvotes: 0
Views: 907
Reputation: 2035
You can do:
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
Make sure to add the AudioToolbox framework.
Upvotes: 2