2011年4月5日 星期二

[iOS] acceleration data

面對手機的直立模式下 (portrait mode)
三軸 (three axes could be positive or negative)

X軸 horizontal across
y軸 vertical across
z軸 runs through from front to back

Two primary classes
  • UIAccelerometer
  • UIAcceleration
How to utilize UIAccelerometer
3 steps
  1. Get the shared accelerometer object
  2. Config the delivery interval (default 100 times/second)
  3. Set the delegate 
    • object to receive acceleration events
    • data is sent to the main thread repeatedly until removed.

How to utilize UIAcceleration
store the data associated with an acceleration event
read-only properties x, y, z

沒有留言: