tags:

views:

251

answers:

2

hi guys ... 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 !** 

        }
    }
}
+2  A: 

You can do:

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

Make sure to add the AudioToolbox framework.

lyonanderson
A: 

thanks ... if i want disable shake method with Setting bundle , what can i do ?

Momeks