2013-10-29 2 views
1

나는 UIPageViewController과 내에서 여러 UIWebViews의를 사용하고 작동하지 않습니다, 나는이와 함께 전에서 내 webviews을 모두로드 : 때때로 모든 잘못을 제외하고있는 UIWebView scalesPageToFit가 제대로

- (void) createContentPages 
{ 
    NSMutableArray *pageStrings = [[NSMutableArray alloc] init]; 
    for (int i = 0; i < chapters.count; i++) 
    { 
     NSString *path; 
     path = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@%@",[arrayDeCapitulos objectAtIndex:i],idioma] ofType:@"txt"]; 
     NSString *arbit; 
     if (path) { 
      arbit = [[NSString alloc]initWithContentsOfFile:arbitPath encoding:NSUTF8StringEncoding error:nil]; 
     } 
     NSString *a; 
     [email protected]"LTR"; 
     if ([idioma isEqualToString:@"h"]) { 
      [email protected]"RTL"; 
     } 
     int size=[[[NSUserDefaults standardUserDefaults]objectForKey:@"preferredSize"]integerValue]; 
     NSString *contentString=[NSString stringWithFormat:@"<html DIR='%@'><head>" 
           "<style>" 
           "*{ padding-bottom:5;font-size:%i;" 
           " font-family:'SBL Hebrew';max-width: %fpx;}" 
           "</style>" 
           "<meta name='viewport' content='width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;' />" 
           "</head>" 
           "<body>" 

           "%@" 

           "</BODY> </HTML>",a,size,self.view.bounds.size.width ,arbit]; 
     [pageStrings addObject:contentString]; 
    } 
    pageContent = [[NSArray alloc] initWithArray:pageStrings]; 
} 

모든 것이 정상입니다 ... 나는 모든 것을 시도해 보았습니다. 누군가 아이디어를 가지고 있습니까?

enter image description here enter image description here

답변

0

내가 이상한 듣고 알고 있지만, HTML의 내용을 이동하여 : 결과

그런 다음 내 다른 클래스에서 내가있는 UIWebView 여기

[webView loadHTMLString:dataObject 
       baseURL:[NSURL URLWithString:@""]]; 
[webView setScalesPageToFit:NO]; 
webView.delegate=self; 

-(void)webViewDidFinishLoad:(UIWebView *)webview 
{ 
    CGSize contentSize = webView.scrollView.contentSize; 
    CGSize viewSize = self.view.bounds.size; 
    float rw = viewSize.width/contentSize.width; 
    webView.scrollView.minimumZoomScale = rw; 
    webView.scrollView.maximumZoomScale = rw; 
    webView.scrollView.zoomScale = rw; 
} 

에게로드입니다 사업부를 만들었습니다.

NSString *contentString=[NSString stringWithFormat:@"<html DIR='%@'><head>" 
       "<style>" 
       "*{ padding-bottom:5;font-size:%i;" 
       " font-family:'SBL Hebrew'}" 

       "</style>" 

       "</head>" 
       "<body>" 
       "<div>%@</div>" 

       "</body> </HTML>",a,size,arbit]; 
0

시도이

NSString *contentString=[NSString stringWithFormat:@"<html DIR='320px'><head>" 
      "<style>" 
      "*{ padding-bottom:5;font-size:%i;" 
      " font-family:'SBL Hebrew'}" 

      "</style>" 

      "</head>" 
      "<body>" 
      "<div>%@</div>" 

      "</body> </HTML>",size,arbit]; 
당신이 DIV 폭을 설정할 수 있습니다

: 320 픽셀; 그리고 HTML 코드에서 높이 100 %.