0

Possible Duplicate:
Get pitch, roll and yaw relative to geographic north on iOS?

Is there a way to detect that iPhone is vertical?

Gyroscope gives us absolute angle relative to a position.

But how can I know if this relative position corresponds to a vertical position?

Community
  • 1
  • 1
Jakikiller
  • 149
  • 1
  • 9

2 Answers2

2
if (UIInterfaceOrientationIsPortrait([[UIDevice currentDevice] orientation])) {
    // device is currently in portrait (vertical) orientation
}
melsam
  • 4,947
  • 1
  • 22
  • 23
2

If you're not looking for precise angular information, just macro orientation, inspect [[UIDevice currentDevice] orientation].

Be sure to read the class documentation for some important implementation details.

Conrad Shultz
  • 8,748
  • 2
  • 31
  • 33
  • ^^ this solve my problem http://stackoverflow.com/questions/9313474/get-pitch-roll-and-yaw-relative-to-geographic-north-on-ios – Jakikiller Jul 21 '12 at 17:25