I have a sophisticated HTML5 website that includes JavaScript. It is displayed in a UIWebView. The JavaScript on the page is supposed to determine whether the iPad is in Portrait or Landscape mode.
Unfortunately, I have encountered an issue. Regardless of whether the iPad is in Portrait or Landscape mode, the function call:
orientationObserver.getOrientation()
always returns "portrait".
Is this a common problem, or am I making a mistake somewhere? I have set the view containing the UIWebView to landscape mode using:
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation==UIInterfaceOrientationLandscapeLeft);
}
When I use:
alert(orientationObserver.getOrientation()
in the JavaScript, it always returns "Portrait" even though the device (and the app) is in landscape mode.