Interpreting Device Movements
Starting with the iPhone 4, iOS devices have an accelerometer and a gyroscopic sensor built into them. There are several ways to use these sensors in an application. The two most common ways are to simply respond to a motion event, which corresponds to shaking the device. The other and more fine-tuned way is to access the orientation data of these sensors directly through the
UIAccelerometer class. Let’s take a look at the shake example first.
Responding a to Motion Event (Shaking)
Whenever an iOS device is shaken, a motion event is generated for the application to consume. Personally, I find using the shake in an application to be super annoying; however, some people think it is a good idea, so let’s look at how ...