2
我使用NativeControls插件,在我的PhoneGap iOS應用程序的本地footerbar。NativeControls和設備的方向
當我旋轉我的iPhone時,頁腳也旋轉,但它只顯示一個沒有任何圖標的黑色欄......當我移動到另一頁時,整個界面完全破碎,我需要重新啓動應用程序。
有誰知道如何解決它?也許NativeControls插件與橫向不兼容?對於設備旋轉
我使用NativeControls插件,在我的PhoneGap iOS應用程序的本地footerbar。NativeControls和設備的方向
當我旋轉我的iPhone時,頁腳也旋轉,但它只顯示一個沒有任何圖標的黑色欄......當我移動到另一頁時,整個界面完全破碎,我需要重新啓動應用程序。
有誰知道如何解決它?也許NativeControls插件與橫向不兼容?對於設備旋轉
支持從來沒有真正實施。 步驟如下:
1)添加取向聽者:
document.addEventListener("orientationChanged",redrawTabBar,false);
2)添加調用的函數,當存在一個取向變化:
function redrawTabBar() {
if (navigator.notification){
PhoneGap.exec("NativeControls.redrawTabBar");
}
}
3)添加的方法中實際的插件(.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解僱。 Inside 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文件。你能澄清那件嗎? –