SUMMARY

In this chapter, you have seen how to obtain the gyroscope and accelerometer data of your iOS device. You also saw how to use the Shake API to help you determine whether your device is being shaken. Combining this knowledge enables you to create very compelling applications (such as shaking the device to refresh the data displayed in a Table View).

EXERCISES

  1. Name the class to use to obtain the gyroscope and accelerometer data on your iOS device.
  2. Name the three events in the Shake API in the iOS SDK.

Answers to the exercises can be found in Appendix D.

image WHAT YOU LEARNED IN THIS CHAPTER

TOPIC KEY CONCEPTS
Accessing the gyroscope and accelerometer data Use the CMMotionManager class.
Detecting shakes You can use either the accelerometer data or the Shake API in the iOS SDK. For the Shake API, handle the following events: motionBegan:, motionEnded:, and motionCancelled:.

Get Beginning iOS 5 Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.