I am trying to build an application wherein I need only the device rotation values. I want the application support to be as low as possible, so my preference would be to read the values from Gyroscope first if the device has its hardware (iPhone 4) or get the values from Accelerometer (iPhone 3G & 3GS).
I would like to write a RotationManager class which would handle interacting with either Gyroscope or Accelerometer, its internal operation will be abstract for the rest of the application. How do I design the RotationManager class? What are the things that should be considered in order to build a good reusable RotationManager instance?
Thanks,
Raj
Apple’s Core Motion framework already does that job for you. Using the
CMMotionManager, you can opt to receive accelerometer and gyroscope events separately or register for combined device motion events that automatically uses all the hardware that is available on the user’s device.