Ios UIDevice定向和UIInterface定向之间有什么区别?
UIDevice定向和UIInterface定向有什么区别? 设备方向:- UI接口方向:-Ios UIDevice定向和UIInterface定向之间有什么区别?,ios,Ios,UIDevice定向和UIInterface定向有什么区别? 设备方向:- UI接口方向:- 设备方向是设备当前所在的方向。我们可以通过此调用获取设备方向: [[UIDevice currentDevice] orientation] 这将返回以下状态之一:UIDeviceOrientation Unknown UIDeviceOrientation纵向UIDeviceOrientation纵向UIDeviceOrientation向上向下UIDeviceOrientation和scape左U
设备方向是设备当前所在的方向。我们可以通过此调用获取设备方向:
[[UIDevice currentDevice] orientation]
这将返回以下状态之一:UIDeviceOrientation Unknown UIDeviceOrientation纵向UIDeviceOrientation纵向UIDeviceOrientation向上向下UIDeviceOrientation和scape左UIDeviceOrientation和scape右UIDeviceOrientation Face Up UIDeviceOrientation Face向下
有两种状态面朝上和面朝下。当设备平放在桌子上时,将返回其中一个。因此,在这种情况下,我们不知道如何布局UI
诀窍是获取状态栏的UIInterfaceOrientation。因为我们希望GUI与状态栏的方向相同。要从状态栏获取UIInterfaceOrientation,我们使用以下代码:
[[UIApplication sharedApplication] statusBarOrientation]
您是否阅读了
UIDeviceOrientation
和UIInterfaceOrientation
的文档?请检查:这并不能回答IMHO的实际问题,因为您没有解释UIInterfaceOrientation是什么。
[[UIDevice currentDevice] orientation]
[[UIApplication sharedApplication] statusBarOrientation]