Actually i want to apply a loop on accelerometer, means i want to start a accelerometer on behalf of loop. if i want to start loop one then want to perform accelerometer reading one time. if loop will run twice then want to run accelerometer twice. But it not happens. What should i do to control accelerometer.
Have a quick look on code
in viewdidload
for (int i=0; i<3; i++)
{
NSLog(@"Hellooooooooo",i);
[[UIAccelerometer sharedAccelerometer] setDelegate:self];
}
and in accelerometer didAccelerate
{
float xx = -[acceleration x];
float yy = [acceleration y];
}
I don’t know what is going wrong ?
help me if u have some idea about it.
thanks in advance for any help.
I have solved this issue .
Just apply a int count variable and assign the count value initialize. Take the value from the user, according to your needs and check out the condition in the accelerometer delegate. Increase the count variable every time and stop the accelerometer at specific count which u want.