1. in .h File --->#define kAccelerationThreshold 2.2
2. include UIAccelerometerDelegate
3. in .m File --> ViewDidload -->[[UIAccelerometer sharedAccelerometer] setDelegate:self];
4. #pragma mark -
#pragma mark Shake event
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{
if (fabsf(acceleration.x) > GlobalRate || fabsf(acceleration.y) > GlobalRate || fabsf(acceleration.z) > GlobalRate)
{
// Your Code Here
}
}
Loading
No comments:
Post a Comment