iphoneobjective-cuiaccelerometer

Find out a bump force in iPhone


I have to develop an application. I have to put an indicator like speedometer in the bike.

iPhone is put in the corner of a Car.

The iPhone is in a placed in a car, from where it can't be dropped anywhere and can't be moved even. ( There is a special place in car where user place iPhone ).

Now, Car is going on a smooth way.

Indicator indicates zero - that is smooth way.

Suppose, a bump is passed by the car.

These movement should be tracked by iPhone. If bump is huge:

If bump is low:

else:

I know how to add shake handler, as given in following link: accelerometer range in iPhone

But here iPhone is not going to be shake? It is in fixed place.

What should be the solution?


Solution

  • You'll need to use the UIAccelerometer, UIAccelerometerDelegate, and UIAcceleration classes. Here is some Sample Code.