UIDeviceOrientationDidChangeNotification为UIOrientationLandscapeRight返回UIOrientationLandscapeLeft [英] UIDeviceOrientationDidChangeNotification is returning UIOrientationLandscapeLeft for UIOrientationLandscapeRight
问题描述
我正在为UIDeviceOrientationDidChangeNotification注册我的viewcontroller,它返回错误的设备方向。
我在viewcontroller的init函数中注册它
I am registering my viewcontroller for UIDeviceOrientationDidChangeNotification and it's return wrong orientation of device. I am registering it in init function of viewcontroller
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handleOrientationChangeNotification:) name: UIDeviceOrientationDidChangeNotification object: nil];
这是我的设备通知接收方法。
This is my device Notification Receiver method.
-(void)handleOrientationChangeNotification:(NSNotification *)notification
{
if(IS_IPHONE)
{
UIDeviceOrientation currentDeviceOrientation = [[UIDevice currentDevice] orientation];
.
.
.
}
每当设备方向改变时,我总是出错方向。
Whenever Device Orientation changed,I am always getting wrong orientation.
推荐答案
我在苹果网站上找到了解决方案 link
I find the solution on apple site on this link
UIDeviceOrientationLandscapeRight
已分配给 UIInterfaceOrientationLandscapeLeft
并且 UIDeviceOrientationLandscapeLeft
已分配给 UIInterfaceOrientationLandscapeRight
。原因是旋转设备需要以相反的方向旋转内容。
UIDeviceOrientationLandscapeRight
is assigned to UIInterfaceOrientationLandscapeLeft
and UIDeviceOrientationLandscapeLeft
is assigned to UIInterfaceOrientationLandscapeRight
. the reason for this is that rotating the device requires rotating the content in the opposite direction.
这篇关于UIDeviceOrientationDidChangeNotification为UIOrientationLandscapeRight返回UIOrientationLandscapeLeft的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!