In this line: [self deviceInterfaceOrientationChanged:interfaceOrientation];

I get this warning

Implicit conversion from enumeration type ' UIInterfaceOrientation' to different enumeration type 'UIDeviceOrientation'?

Can u help me ?please. thank u

Here's the code:

     -(void) receivedRotate: (NSNotification*) notification
{
    NSLog(@"receivedRotate");
    UIDeviceOrientation interfaceOrientation = [[UIDevice currentDevice] orientation];

    if(interfaceOrientation != UIDeviceOrientationUnknown) {
        [self deviceInterfaceOrientationChanged:interfaceOrientation];


    } else {
        NSLog(@"Unknown device orientation");
    }
}
1

There are 1 answers

1
Raul Huerta On

UIDeviceOrientation and UIInterfaceOrientation are different types, the first is the device orientation and includes other states like Face up or Face Down among others, while the second only covers 2D states, like Portrait and Landscape.

Don't get the device orientation from the device but from the status bar like this:

[[UIApplication sharedApplication] statusBarOrientation] 

This method will return a UIInterfaceOrientation value and the problem will go away.