iPhone responds to motion using a built-in accelerometer. When you rotate iPhone from portrait to landscape, the accelerometer detects the movement and changes the display accordingly. So you immediately see the entire width of a web page, view a photo in its proper aspect ratio or control a game using only your movements.
How it works.
The accelerometer inside iPhone uses three elements: a silicon mass, a set of silicon springs and an electrical current. The silicon springs measure the position of the silicon mass using the electrical current. Rotating iPhone causes a fluctuation in the electrical current passing through the silicon springs. The accelerometer registers these fluctuations and tells iPhone to adjust the display accordingly.
http://www.apple.com/au/iphone/features ... meter.html