检测 iPhone 设备是否平整
-
21-09-2019 - |
题
为了在拍照时检测手机的方向,我使用
orientation == UIDeviceOrientationLandscapeRight
orientation == UIDeviceOrientationPortraitUpsideDown
orientation == UIDeviceOrientationPortrait
orientation == UIDeviceOrientationLandscapeLeft
但如果从侧面拍摄照片,这些方法就有效。如何检查 iPhone 是否向下倾斜至平整状态,例如:拍摄航拍照片时?
解决方案
有存在该设备取向其他常数:
typedef enum {
UIDeviceOrientationUnknown,
UIDeviceOrientationPortrait,
UIDeviceOrientationPortraitUpsideDown,
UIDeviceOrientationLandscapeLeft,
UIDeviceOrientationLandscapeRight,
UIDeviceOrientationFaceUp,
UIDeviceOrientationFaceDown
} UIDeviceOrientation;
您可以在这里找到他们:的的UIDevice类参考
其他提示
有在 http://developer.apple.com/iphone样品应用该图表生来自加速度计的数据。您的设备上安装它,看看你得到的数据类型。
在样品应用程序具有一个选项(我认为这是“阻尼”),有效地抵消了重力。你不想这样做 - 其实重力是怎么回事Z轴“加速”您的设备时,它的平...
不隶属于 StackOverflow