I solved this by using the willRotateToInterfaceOrientation method and
from there called a javascript function with the new orientation.
Someone might find this useful, a bit modified from
http://groups.google.com/group/phonegap/browse_thread/thread/cbf78e8ce2b81f9d
to make it work:
- (void)willRotateToInterfaceOrientation:
(UIInterfaceOrientation)toInterfaceOrientation duration:
(NSTimeInterval)duration {
NSString * jsCallBack = nil;
double i = 0;
switch (toInterfaceOrientation){
case UIInterfaceOrientationPortrait:
i = 0;
break;
case UIInterfaceOrientationPortraitUpsideDown:
i = 180;
break;
case UIInterfaceOrientationLandscapeLeft:
i = 90;
break;
case UIInterfaceOrientationLandscapeRight:
i = -90;
break;
}
GlassAppDelegate *appDelegate = (GlassAppDelegate*)[[UIApplication
sharedApplication] delegate];
jsCallBack = [[NSString alloc] initWithFormat:@"setOrientation(%f);
window.onorientationchange();", i];
[appDelegate.webView
stringByEvaluatingJavaScriptFromString:jsCallBack];
[jsCallBack release];
}
For example the appDelegate.webView property you have to declare and
then set it in GlassAppDelegate.m like this:
- (void)webViewDidFinishLoad:(UIWebView *)theWebView
{
[window bringSubviewToFront:viewController.view];
webView = theWebView;
}
Maybe thats not the best explanation..