2012-05-02 6 views
1

방향 w에서 잘 작동하는 ipad xib에서 webview가 있습니다. 하지만 난 줌 - 세로 모드로 만든 다음 풍경 웹뷰에서 rotationg하는ipad 방향 문제가있는 웹보기 및 확대

- (void)viewDidLoad 
{ 
    NSString *[email protected]"http://www.plus.al"; 
    NSURLRequest *request=[NSURLRequest requestWithURL:[NSURL URLWithString:urlString]]; 
    webView.scalesPageToFit = YES; 
    [webView loadRequest:request]; 
} 

- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation 
{ 
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) 
    { 
     if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) 
     { 

      webView.frame=CGRectMake(0, 0, 1024, 748); 

     } 
     if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) 
     { 

      webView.frame=CGRectMake(0, 0, 768, 1004); 

     } 
    else { 
     if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) 
     { 
      webView.frame=CGRectMake(0, 0, 480, 300);  
     } 
     if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) 
     { 

      webView.frame=CGRectMake(0, 0, 320, 460); 
     } 
    } 
    return YES; 
} 

사전에 찾아 와요 고마워요 도와주세요 오른쪽에서 마진을 취합니다.

+0

instead- 다음 코드를 사용할 필요가 : //stackoverflow.com/questions/2890673/iphone-uiwebview-width-does-not-fit-after-zooming-operation를 -uiinterfaceorienta/9035545 # 9035545 –

+0

@ Naina Soni 나는 이것을 시도했지만, 항상 두 방향 모두 확대/축소를 수정하는 것으로 표시됩니다. –

답변

0

는이 -http을 시도

- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation 
{ 
    return YES; 
} 


- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration { 
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) 
    { 
     if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) 
     { 
      self.webView.frame=CGRectMake(0, 0, 1024, 748); 
     } 
     if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) 
     { 
      self.webView.frame=CGRectMake(0, 0, 768, 1004); 
     } 
     else { 
      if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) 
      { 
       self.webView.frame=CGRectMake(0, 0, 480, 300);  
      } 
      if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) 
      {     
       self.webView.frame=CGRectMake(0, 0, 320, 460); 
      } 
     } 
    } 
}