Search code examples
iosobjective-cxcodeuiwebviewhybrid-mobile-app

UIWebview Landscape support in Hybrid Application


I am developing an hybrid application using UIWebview. All the HTML pages are loaded from Local. I have requirement that only one page should support both landscape and portrait mode. Rest all the html page should support portrait mode only. So i have done following implementation for that:

- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
if (isFullScreenPlaying) {
    NSLog(@"**********************************orienattion Landscape%@",[window description]);
    return UIInterfaceOrientationMaskAllButUpsideDown;
}
NSLog(@"**********************************orienattion Portrait%@",[window description]);
return UIInterfaceOrientationMaskPortrait;
}

I am enabling the isFullScreenPlaying variable when i have have url request equal to full screen playing:

**if([urlString hasPrefix:@"fullscreenvieweron://"]){
    NSLog(@"**********************************isFullScreenPlayingYes");
    isFullScreenPlaying = YES;
    return NO;
}**

But problem comes after user rotate the device in landscape. The full screen html page come in landscape mode. Bur when user close the full screen html page then the previous loaded page also in landscape mode. Is there any way in HTML or Native IOS side so that i can set orientation support for particular html page ?


Solution

  • Finally by applying various tricks i come to the solution. I posted in the following link:

    http://cocoainios.blogspot.in/2014/11/implement-orientation-modes-in-iphone.html