iPhone SDK摇晃和振动

时间:2009-12-06 20:41:55

标签: iphone

iPhone摇晃时如何使用振动? 这是我的代码:

#pragma mark -
- (void)accelerometer:(UIAccelerometer *)accelerometer 
        didAccelerate:(UIAcceleration *)acceleration {
   {
        if (acceleration.x > kAccelerationThreshold 
            || acceleration.y > kAccelerationThreshold
            || acceleration.z > kAccelerationThreshold) {


  **//Vibrate it !** 

        }
    }
}

1 个答案:

答案 0 :(得分:2)

你可以这样做:

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

确保添加AudioToolbox框架。