Guest User

Untitled

a guest
May 21st, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. // put this shiz somewhere
  2. [[UIAccelerometer sharedAccelerometer] setUpdateInterval:0.1];
  3. [[UIAccelerometer sharedAccelerometer] setDelegate:self];
  4.  
  5. // put this in ur interface declaration as a protocol declaration
  6.  
  7. <UIAccelerometerDelegate>
  8.  
  9. // put thiz in the class uve set as the delegate (this class basically)
  10. #define kFilteringFactor 0.1
  11. -(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
  12. {
  13. UIAccelerationValue accelY;
  14. accelY = (acceleration.y * kFilteringFactor) + (accelY * (1.0 - kFilteringFactor));
  15. if(accelY > 0.075){
  16. // the shiz that happens when u haz shake
  17. }
  18. }
Add Comment
Please, Sign In to add comment