Hi Samir,
I had a similar situation. When using PhoneGap 0.8.0 and also 0.9.0
when rotating to landscape the tab bar disappears leaving a blank
(black) area where it was at the bottom. If I position the tab bar at
the top then it stays when I rotate to landscape and not black box
appears.
I'm very new to Obj-C and my fix is very probably not the best way to
resolve this but it works and I have a deadline... anyway here's my
fix (code for 0.9.0, may work in 0.8.0 as well but I've not tested):
in PhoneGapViewController.h:
@interface PhoneGapViewController : UIViewController {
IBOutlet UIWebView *webView;
NSArray* supportedOrientations;
CGRect webViewBounds; // ADD THIS LINE
}
in PhoneGapViewController.m:
/**
Called by UIKit when the device starts to rotate to a new
orientation. This fires the \c setOrientation
method on the Orientation object in JavaScript. Look at the
JavaScript documentation for more information.
*/
- (void)willRotateToInterfaceOrientation:
(UIInterfaceOrientation)toInterfaceOrientation duration:
(NSTimeInterval)duration {
double i = 0;
switch (toInterfaceOrientation){
case UIInterfaceOrientationPortrait:
i = 0;
webViewBounds =
CGRectMake(0,0,webView.bounds.size.width,webView.bounds.size.height -
49); // ADD THIS LINE
break;
case UIInterfaceOrientationPortraitUpsideDown:
i = 180; // I'm not using upside down view so haven't added
anything here
break;
case UIInterfaceOrientationLandscapeLeft:
i = 90;
webViewBounds = CGRectMake(0,0,320,460); // ADD THIS LINE
break;
case UIInterfaceOrientationLandscapeRight:
i = -90;
webViewBounds = CGRectMake(0,0,320,460); // ADD THIS LINE
break;
}
[webView stringByEvaluatingJavaScriptFromString:[NSString
stringWithFormat:@"navigator.orientation.setOrientation(%f);", i]];
[webView setFrame:webViewBounds]; // ADD THIS LINE
}
Hope this resolves your issue as well.
If anyone can improve my code please feel free :-)
Regards, Matthew
--
You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to
phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
For more info on PhoneGap or to download the code go to
www.phonegap.com