Search code examples
iosobjective-cuiinterfaceorientation

orientation issue iOS 5


I have created an iPad application that only supports landscape orientation (left and right).Ìt works perfectly on iOS 6, but on iOS 5 the application is turned.

Could any one please help me to resolve this issue.


Solution

  • Just add following method in ViewController

    - (BOOL)shouldAutorotateToInterfaceOrientation:
        (UIInterfaceOrientation)toInterfaceOrientation {
             return (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
         toInterfaceOrientation == UIInterfaceOrientationLandscapeRight);
    }
    

    shouldAutorotateToInterfaceOrientation method deprecated in iOS 6, still needed for iOS 5 support.