デバイスローテーションのサポートは実際には実装されていません。 ここステップである:
function redrawTabBar() {
if (navigator.notification){
PhoneGap.exec("NativeControls.redrawTabBar");
}
}
3)メソッドを追加:姿勢変化がある場合
document.addEventListener("orientationChanged",redrawTabBar,false);
2)と呼ばれる機能を追加します。
1)配向リスナーを追加します実際のプラグイン(.m):
- (void)redrawTabBar:(NSArray*)arguments withDict:(NSDictionary*)options
{
tabBar.frame=CGRectMake(0, self.webView.frame.size.height, self.webView.frame.size.width, 50);
}
4)orientationChangedイベントwebviewによって起動されます。内部MainViewcontroller.m
- (void)didRotateFromInterfaceOrientation: (UIInterfaceOrientation)fromInterfaceOrientation
{
int i = 0;
switch (self.interfaceOrientation){
case UIInterfaceOrientationPortrait:
i = 0;
break;
case UIInterfaceOrientationPortraitUpsideDown:
i = 180;
break;
case UIInterfaceOrientationLandscapeLeft:
i = -90;
break;
case UIInterfaceOrientationLandscapeRight:
i = 90;
break;
}
NSString* jsString =
@"(function(){"
"var e = document.createEvent('Events');"
"e.initEvent('orientationChanged');"
"document.dispatchEvent(e);"
"})();";
NSLog(@"Orientation Changed");
[self.webView stringByEvaluatingJavaScriptFromString:jsString];
}
私は同じ正確な問題を抱えています。しかし、私はMainViewcontroller.mファイルを持っていないようです。あなたはその作品を明確にすることができますか? –