我需要从ViewController获取设备方向.我不能依据:
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
Run Code Online (Sandbox Code Playgroud)
因为它有时会返回未知方向(例如,当设备放在桌子上时).
我只需知道我当前的UIView显示的方向(左侧是横向还是横向右侧).当方向改变时,我不需要更新此值,我只想知道它,当我要求它时.只是一些参考view.orientation ;).有什么东西可以帮助我吗?我已经阅读了UIView文档,发现了一些对UIWindow的引用,但没有什么可以帮助我.