Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • iPhone orientation doesn't work in iOS 6 using config file with Phonegap Build

    • 0
    • 3
    • 3
    • 1
    • 0
    • 0
    • 0
    • 0
    • 556
    Comment on it

    Solution 1: By adding UISupportedInterfaceOrientations

            platroms/ios/{ProjectName}/{ProjectName-info.plist
    
            add these lines:
    
            For Iphone:
    
    
    
    <key>UISupportedInterfaceOrientations</key>
                    <array>
                      <string>UIInterfaceOrientationPortrait</string>
                      <string>UIInterfaceOrientationLandscapeLeft</string>
                      <string>UIInterfaceOrientationPortraitUpsideDown</string>
                      <string>UIInterfaceOrientationLandscapeRight</string>
                    </array>
            For Ipad:
    
    
    
    <key>UISupportedInterfaceOrientations~ipad</key>
                    <array>
                      <string>UIInterfaceOrientationPortrait</string>
                      <string>UIInterfaceOrientationLandscapeLeft</string>
                      <string>UIInterfaceOrientationPortraitUpsideDown</string>
                      <string>UIInterfaceOrientationLandscapeRight</string>
                    </array>
    

    Solution 2:

    In the latest version of iOS6 shouldAutorotateToInterfaceOrientation is not used in iOS 6.0 .

    Instead of shouldAutorotateToInterfaceOrientation we use the shouldAutorotate

    - (BOOL)shouldAutorotate {
        return YES;
    }
    

    And also please make sure that in

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
    

    must be set the viewController as rootviewcontroller

    self.window.rootViewController = self.navigationController;
    
    
    -(BOOL)shouldAutorotate
    {
        return [[self.viewControllers lastObject] shouldAutorotate];
    }
    
    -(NSUInteger)supportedInterfaceOrientations
    {
        return [[self.viewControllers lastObject] supportedInterfaceOrientations];
    }
    
    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
    {
        return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
    }
    

    Solution 3:

    you can add this to your config.xml:

    <preference name="phonegap-version" value="2.1.0" /> 
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: