2011-08-09 7 views
2

私はPhoneGap iOSアプリケーションでNativeControlsプラグインとネイティブフッタバーを使用しています。NativeControlsとデバイスオリエンテーション

私のiPhoneを回転させると、フッタバーも回転しますが、アイコンのない黒いバーが表示されます...そして、別のページに移動すると、インターフェイス全体が完全に壊れてしまい、アプリケーションを再起動する必要があります。

誰でも解決方法を知っていますか? NativeControlsプラグインが横向きの向きに対応していない可能性がありますか?

答えて

0

デバイスローテーションのサポートは実際には実装されていません。 ここステップである:

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]; 
} 
+0

私は同じ正確な問題を抱えています。しかし、私はMainViewcontroller.mファイルを持っていないようです。あなたはその作品を明確にすることができますか? –

関連する問題