Skip to Content
Beginning iOS 5 Application Development
book

Beginning iOS 5 Application Development

by Wei-Meng Lee
January 2012
Beginner content levelBeginner
655 pages
16h 35m
English
Wrox
Content preview from Beginning iOS 5 Application Development

15

Accessing the Sensors

WHAT YOU WILL LEARN IN THIS CHAPTER

  • How to obtain the gyroscope data from your iOS device
  • How to obtain accelerometer data from your iOS device
  • How to detect shakes to your device

Beginning with iPhone 4, Apple introduced a new gyroscopic sensor in addition to the original accelerometer sensor available since the first iPhone. Using the gyroscope, you can measure the device's angular acceleration around the x, y, and z axes. This enables you to accurately measure the yaw, pitch, and roll of the device. In addition to the gyroscope, the built-in accelerometer measures the linear acceleration of the device along the three axes. With these two sensors, your application can determine how far, how fast, and in which direction it is moving in space.

In this chapter, you learn how to access the gyroscope and accelerometer data and use the Shake API to detect shakes to your iPhone.

image

FIGURE 15-1

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering iOS 12 Programming - Third Edition

Mastering iOS 12 Programming - Third Edition

Donny Wals
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer

Publisher Resources

ISBN: 9781118144251Purchase book