iOS

iOS Accelerometer

iOS Accelerometer

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:


Top course recommendations for you

    Leap year program in Python
    1 hrs
    Beginner
    2.2K+ Learners
    4.46  (70)
    Prime Number in Java
    2 hrs
    Beginner
    2.6K+ Learners
    4.52  (54)
    Exception and File Handling with Python
    2 hrs
    Intermediate
    4.6K+ Learners
    4.33  (141)
    Heap Data Structure
    1 hrs
    Beginner
    2.1K+ Learners
    4.15  (144)
    Prime Number Program in Python
    1 hrs
    Beginner
    2.2K+ Learners
    4.19  (80)
    Python Uses
    1 hrs
    Beginner
    5.7K+ Learners
    4.32  (278)
    R Studio Basics
    1 hrs
    Beginner
    5.1K+ Learners
    4.5  (298)
    Class in java
    1 hrs
    Beginner
    7.3K+ Learners
    4.37  (310)
    Multithreading In Java
    2 hrs
    Intermediate
    5.7K+ Learners
    4.38  (349)