大家好,
当我锁定屏幕方向时,我希望使用[[UIDevice currentDevice] orientation]来获取屏幕的方向。但它总是返回UIDeviceOrientationPortrait,所以我的问题是如何获取真实的设备方向。
非常感谢您的帮助。
大家好,
当我锁定屏幕方向时,我希望使用[[UIDevice currentDevice] orientation]来获取屏幕的方向。但它总是返回UIDeviceOrientationPortrait,所以我的问题是如何获取真实的设备方向。
非常感谢您的帮助。
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
如果仍然无法正常工作,您还可以使用状态栏来确定当前方向(如果您的UI正在旋转),方法如下:
[[UIApplication sharedApplication] statusBarOrientation];