2011-08-09 3 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에 의해 해고됩니다. 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]; 
} 
+0

동일한 정확한 문제가 있습니다. 그러나 MainViewcontroller.m 파일이없는 것 같습니다. 그 조각을 분명히 할 수 있니? –