Setting up the Accelerometer


#1

An interesting question has come to mind here for me. I understand that only one instance of the accelerometer can exist, which is fine, however I’m wondering why, instead of using HypnosisViewController (in the book’s example), one can’t simply create a dedicated “delegate class” which uses the accelerometer, and then have the various objects in the application access it that way?

Can someone clarify?


#2

If you have an application where many objects need to access the accelerometer data, you can take this approach. In practice, this happens pretty rarely. If a view controller manages an entire screen, and it is the delegate of the accelerometer, it can get any pertinent accelerometer data to any of the views on the screen. Views not on the screen typically don’t need to be updated.