iPhone摇晃时如何使用振动? 这是我的代码:
#pragma mark -
- (void)accelerometer:(UIAccelerometer *)accelerometer
didAccelerate:(UIAcceleration *)acceleration {
{
if (acceleration.x > kAccelerationThreshold
|| acceleration.y > kAccelerationThreshold
|| acceleration.z > kAccelerationThreshold) {
**//Vibrate it !**
}
}
}
答案 0 :(得分:2)
你可以这样做:
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
确保添加AudioToolbox框架。