【发布时间】:2016-09-23 12:05:19
【问题描述】:
我有一些代码,我曾经使用presentingViewController.interfaceOrientation 来确定当前UIViewController 支持的界面方向。由于interfaceOrientation 已被弃用,我已经用[[UIApplication sharedApplication] statusBarOrientation] 替换了该代码并且它工作正常。但是,在 iOS9 和 iOS8 中,它不起作用(当我检查 shouldAutorotateToInterfaceOrientation、supportedInterfaceOrientations 和 preferredInterfaceOrientationForPresentation 中的方向时,我得到了一些非常有趣的结果)。
所以我想知道,有没有在不使用[[UIApplication sharedApplication] statusBarOrientation] 的情况下确定视图控制器的界面方向? (需要区分横向的左右,纵向的上下颠倒)。
【问题讨论】:
-
你能得到答案吗?
-
@DeepakSharma 我不记得了。当我查看我的代码时,我正在使用 [[UIApplication sharedApplication] statusBarOrientation] 就像我上面所说的那样,所以不确定我在 iOS9 和 iOS8 中做了什么来解决这个问题。
标签: ios uiviewcontroller uiinterfaceorientation