Hey guys, still somewhat new at this so I could use a little help. I am trying to get the accelerometer to work in a class i created ("myclass"). I put the following code in my applicationDidFinishLauching method in my appDelegate:
[[UIAccelerometer sharedAccelerometer] setUpdateInterval1.0 / 60.0f)];
[[UIAccelerometer sharedAccelerometer] setDelegate:self];
NSLog(@"Accelerometer configured and started");
Then I put the following code under it:
- (void)accelerometerUIAccelerometer *)accelerometer didAccelerate: (UIAcceleration *)acceleration
{
if ([acceleration x] >=2 || [acceleration y] >=2 || [acceleration z] >=2)
{
NSLog(@"X=%f Y=%f Z=%f", [acceleration x], [acceleration y], [acceleration z]);
}
}
That all works perfectly...my question is how do I get that to work in a class that I created?
Thanks
[[UIAccelerometer sharedAccelerometer] setUpdateInterval1.0 / 60.0f)];
[[UIAccelerometer sharedAccelerometer] setDelegate:self];
NSLog(@"Accelerometer configured and started");
Then I put the following code under it:
- (void)accelerometerUIAccelerometer *)accelerometer didAccelerate: (UIAcceleration *)acceleration
{
if ([acceleration x] >=2 || [acceleration y] >=2 || [acceleration z] >=2)
{
NSLog(@"X=%f Y=%f Z=%f", [acceleration x], [acceleration y], [acceleration z]);
}
}
That all works perfectly...my question is how do I get that to work in a class that I created?
Thanks