Search code examples
cordovaios6xcode4.5uiinterfaceorientation

How do i support only landscape version for ios 6.0 in phonegap application?


Checked with so many asked questions about this but nothing has worked for my case.So i needed to ask it again.

I am building app with phone-gap framework.Upto ios 5 it's running fine but as the case with ios 6.0 those methods are not supported so i replaced them with:

- (BOOL)shouldAutorotate
{
return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}

in my MainViewController.m file.

I need my entire app in only landscape left and landscape right.

In my plist file i have mentioned landscape left and right for both iphone and ipad.

Any idea would be of great help.

thanks


Solution

  • Got the solution.This problem occurs because the MainViewController is not set to be the rootViewController in AppDelegate.m. In your AppDelegate.m replace:

    [self.window addSubview:self.viewController.view];
    

    with

    self.window.rootViewController = self.viewController;
    

    Then it behaves properly for my app running on ios 6.0