Skip to main content

Device Orientation and Motion

  • Chapter
  • First Online:
Pro iPhone Development with Swift 4
  • 1082 Accesses

Abstract

The iPhone, iPad, and iPod touch all include a built-in accelerometer — the tiny device that lets iOS know how the device is being held and if it’s being moved. iOS uses the accelerometer to handle autorotation, and many games use it as a control mechanism. The accelerometer can also be used to detect shakes and other sudden movement. This capability was extended even further with the introduction of the iPhone 4, which was the first iPhone to include a built-in gyroscope to let developers determine the angle at which the device is positioned around each axis. The gyro and accelerometer are now standard on all new iPads and iPod touches. In this chapter, we’ll explore using the Core Motion framework to access the gyro and accelerometer values in your application.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 29.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Molly Maskrey and Wallace Wang

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Maskrey, M., Wang, W. (2018). Device Orientation and Motion. In: Pro iPhone Development with Swift 4. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-3381-8_5

Download citation

Publish with us

Policies and ethics