Monday, August 31, 2009

Catching Acceleration Events

-(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{
float xx = -[acceleration x];
float yy = [acceleration y];
float angle = atan2(yy, xx);
[arrowView setTransform:CGAffineTransformMakeRotation(angle)];
}
-(void) ViewDidLoad
{
[[UIAccelerometer sharedAccelerometer] setDelegate:self];
}

No comments:

Post a Comment