是否有办法确定 iPhone 何时处于背面放置状态?
这是在一个表面上,或者用户将其握在手中,然后移动手机,使其平放在半空中。
我知道 iPhone 有陀螺仪和加速计,但我不确定如何使用它们来找出这一点。
最佳答案
typedef NS_ENUM(NSInteger, UIDeviceOrientation) {
UIDeviceOrientationUnknown,
UIDeviceOrientationPortrait, // Device oriented vertically, home button on the bottom
UIDeviceOrientationPortraitUpsideDown, // Device oriented vertically, home button on the top
UIDeviceOrientationLandscapeLeft, // Device oriented horizontally, home button on the right
UIDeviceOrientationLandscapeRight, // Device oriented horizontally, home button on the left
UIDeviceOrientationFaceUp, // Device oriented flat, face up
UIDeviceOrientationFaceDown // Device oriented flat, face down
};
关于objective-c - 确定 iPhone 何时平放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30564995/