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.
I find the solution on apple site on this link
UIDeviceOrientationLandscapeRightis assigned toUIInterfaceOrientationLandscapeLeftandUIDeviceOrientationLandscapeLeftis assigned toUIInterfaceOrientationLandscapeRight. the reason for this is that rotating the device requires rotating the content in the opposite direction.