【发布时间】:2012-07-21 17:02:17
【问题描述】:
可能重复:
Get pitch, roll and yaw relative to geographic north on iOS?
有没有办法检测 iPhone 是垂直的?
陀螺仪为我们提供了相对于位置的绝对角度。
但是我怎么知道这个相对位置是否对应一个垂直位置呢?
【问题讨论】:
标签: objective-c ios gyroscope core-motion
可能重复:
Get pitch, roll and yaw relative to geographic north on iOS?
有没有办法检测 iPhone 是垂直的?
陀螺仪为我们提供了相对于位置的绝对角度。
但是我怎么知道这个相对位置是否对应一个垂直位置呢?
【问题讨论】:
标签: objective-c ios gyroscope core-motion
if (UIInterfaceOrientationIsPortrait([[UIDevice currentDevice] orientation])) {
// device is currently in portrait (vertical) orientation
}
【讨论】:
如果您不是在寻找精确的角度信息,而只是在宏观方向,请检查 [[UIDevice currentDevice] orientation]。
请务必阅读类文档以了解一些重要的实现细节。
【讨论】: