Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/97.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iPhone-屏幕旋转?_Iphone_Ios_Uiinterfaceorientation_Uideviceorientation - Fatal编程技术网

iPhone-屏幕旋转?

iPhone-屏幕旋转?,iphone,ios,uiinterfaceorientation,uideviceorientation,Iphone,Ios,Uiinterfaceorientation,Uideviceorientation,UIDeviceOrientation和UIInterfaceOrientation之间有什么区别 我应该使用哪一个来检测UIView上的旋转?UIDeviceOrientation指设备的物理方向,而UIInterfaceOrientation指用户界面的方向 因此,您需要设置的是autoResizeMask,以便在调整superview的大小时正确调整视图的大小。设置视图的flexibleWidth和flexibleHeight。检查 另请参阅 UIDeviceOrientation为您提

UIDeviceOrientation
UIInterfaceOrientation
之间有什么区别


我应该使用哪一个来检测UIView上的旋转?

UIDeviceOrientation
指设备的物理方向,而
UIInterfaceOrientation
指用户界面的方向

因此,您需要设置的是autoResizeMask,以便在调整superview的大小时正确调整视图的大小。设置视图的flexibleWidth和flexibleHeight。检查

另请参阅


UIDeviceOrientation
为您提供有关物理设备本身的信息,而
UIInterfaceOrientation
则为您提供它所显示视图的方向。这些不需要匹配;当用户使用方向锁或设备方向为朝上时


您可能想检查
uiinterface-orientation
UIViewController
上的旋转方法,以确定视图已旋转或应旋转的时间。

我希望一年前就知道的事情!我必须使用设备定位来制定一个完整的解决方案来解决这个问题,但没有涵盖几个角落的情况。几个小时的头痛。。。非常感谢。您的上述代码不正确。您正在将设备方向指定给UIInterfaceOrientation变量。应该是
UIDeviceOrientation-orientation=[[UIDevice-currentDevice]orientation]
或者应该是
UIInterfaceOrientation-orientation=self.interfaceOrientation
,其中self是UIViewController。
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]