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)