Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // put this shiz somewhere
- [[UIAccelerometer sharedAccelerometer] setUpdateInterval:0.1];
- [[UIAccelerometer sharedAccelerometer] setDelegate:self];
- // put this in ur interface declaration as a protocol declaration
- <UIAccelerometerDelegate>
- // put thiz in the class uve set as the delegate (this class basically)
- #define kFilteringFactor 0.1
- -(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
- {
- UIAccelerationValue accelY;
- accelY = (acceleration.y * kFilteringFactor) + (accelY * (1.0 - kFilteringFactor));
- if(accelY > 0.075){
- // the shiz that happens when u haz shake
- }
- }
Add Comment
Please, Sign In to add comment