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]