gpt4 book ai didi

ios - iOS 8.1.3 中设备方向返回错误

转载 作者:行者123 更新时间:2023-11-29 02:15:26 26 4
gpt4 key购买 nike

我正在从一个 Controller 导航到另一个 Controller (调用设备摄像头),但发现第二个 Controller 的方向被 iOS 返回为纵向,即使我处于纵向模式也是如此。

最初我在第一个 Controller 中时处于纵向模式,然后将设备倾斜到横向模式并导航到下一个 Controller (调用相机)。

我只想在横向时执行一些事件,所以我检查了这个条件,但即使我的设备横向时,控件也不会出现。

if(orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight)
{
// perform an activity
}

最佳答案

您可以使用[[UIApplication sharedApplication] statusBarOrientation]属性获得准确的方向。点击here进行快速比较。

关于ios - iOS 8.1.3 中设备方向返回错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28809485/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com