The accelerometer detects changes in the device's position in the three directions of x, y, and z. You can determine the device's present position concerning the ground. You'll need to run this example on a device to test it, as it won't function on a simulator.\
Steps in Using an Accelerometer:
Step 1: Make a basic View-based application
Step 2: Create three ibOutlets in ViewController.xib and name them xlabel, ylabel, and zlabel
Step 3: Make the following changes to ViewController.h
Step 4: Make the following changes to ViewController.m
Output
You'll get the following output if you launch the app on an iPhone device: