使用加速度计检测iPad锁定开关触发器?
因此,由于复杂的原因,我自己管理视图旋转,并且仅将 UIDeviceOrientationPortrait 实现为自动旋转方向。
无论如何,当点击iPad上的屏幕锁定时,设备将旋转到UIDeviceOrientationPortrait,这将导致我的代码旋转,这是我不希望发生的。例如,用户将设备保持在“横向模式”,即我已经手动将 UI 旋转到横向模式,并且他/她单击屏幕锁定,它会将 UI 旋转到纵向模式,即使用户这样做了根本不移动设备。
因此,我需要一种方法来区分屏幕锁定时发生的旋转到纵向模式和设备旋转时发生的旋转。因此,我想以某种方式使用加速度计来检测设备是否真正“旋转”或按钮是否被单击。
谢谢!
So for complicated reasons I am managing view rotations myself, and am only implementing UIDeviceOrientationPortrait
as the autorotating orientation.
Anyway, when one clicks the screen lock on the iPad, the device will rotate to UIDeviceOrientationPortrait, which will cause my code to rotate, which I do not want to happen. For instance of the user is holding the device in "landscape mode", i.e. I have already manually rotated the UI to landscape mode, and he/she clicks the screen lock, it will rotate the UI to portrait mode, even though the user did not move the device at all.
So somehow I need a way to differentiate between rotations to portrait mode occuring from the screen lock, and those occuring from device rotation. As such, I would like somehow to use the accelerometer to detect whether or not the device was actually 'rotated' or whether the button was clicked.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论