iPhone – 屏幕旋转?

UIDeviceOrientationUIInterfaceOrientation什么区别?

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

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

您可能希望检查UIInterfaceOrientationUIViewController上的旋转方法,以确定何时已经或应该轮换视图。

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

因此,您需要设置的是autoResizeMask,以便在调整其superview时调整视图的大小。 为视图设置flexibleWidth和flexibleHeight。 查看http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIDevice_Class/Reference/UIDevice.html

另外 – 参考

UIDEVICE方向

 UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]