Mc.Lover
Mc.Lover

Reputation: 4994

iPhone SDK shake and vibrate

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

Answers (1)

lyonanderson
lyonanderson

Reputation: 2035

You can do:

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

Make sure to add the AudioToolbox framework.

Upvotes: 2

Related Questions