아이폰어플개발정보2010. 6. 24. 11:35
흔드는거 감지하기

by alex 23. 9월 2009 11:50


#define kAccelerationThreshold  2.2

//Somewhere in initialization

UIAccelerometer *accel = [UIAccelerometer sharedAccelerometer];

accel.delegate = self;

accel.updateInterval = 1.0f/10.0f;

- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {

 if (fabsf(acceleration.x) > kAccelerationThreshold || fabsf(acceleration.y) > kAccelerationThreshold || fabsf(acceleration.z) > kAccelerationThreshold) {

  NSLog(@"Shaking!!!");

 }

}



출처 : http://blog.naver.com/PostView.nhn?blogId=amoros21&logNo=140107111023
Posted by 오늘마감

댓글을 달아 주세요