开发者

iPhone SDK shake and vibrate

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜