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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2018 Molly Maskrey and Wallace Wang
About this chapter
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
DOI: https://doi.org/10.1007/978-1-4842-3381-8_5
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-3380-1
Online ISBN: 978-1-4842-3381-8
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)