2012-02-28 8 views
2

私のアプリにhtmlメールを表示しています。しかしアップルのメールアプリケーションがしている間、フルサイズに画像を伸ばすことはありません。以下のスクリーンショットを参照してください。どのようにリンゴはこれを達成するための任意のアイデアですか?UIScrollView内のUIWebViewはコンテンツを正しく表示しませんか?

  1. 私のアプリケーションのWebビュー

enter image description here

Appleのメールアプリ

enter image description here

+0

サンプルWebページへのリンクを投稿できますか?そのHTMLコンテンツをwebviewに埋め込む方法を投稿できますか? – alex

答えて

1

私はこれがあなたの質問に答えていない知っているが、Appleは、明示的に埋め込むUIWebViewsに対して警告しますUIWebViewクラスリファレンスのUIScrollViewsで

Important You should not embed UIWebView or UITableView objects in UIScrollView objects. If you do so, unexpected behavior can result because touch events for the two objects can be mixed up and wrongly handled. 

しかし、それは価値があるのですが、UIWebViewのscalesPageToFitプロパティを試してみましたか?

+0

私はscrollViewの中にUIWebViewを埋め込みません。はい、scalePagesToFit = TRUEを使用しています。 –

0

ない私はこれを持っているが、それは私のノートにあった場所を確認しますが。
レンダリングされた後にフィットするように、少しのJS作業を行う必要があります。

#pragma mark - 
#pragma mark UIWebViewDelegate methods 
-(void)webViewDidFinishLoad:(UIWebView *)webView{ 
if (webView!=bioWebView)return; 

float h; 

NSLog(@"web view is %f high", bioWebView.frame.size.height); 
NSString *heightString = [bioWebView stringByEvaluatingJavaScriptFromString:@"document.getElementById("body").offsetHeight;"]; 
NSLog(@"web content is %@ high",heightString); 

h = [heightString floatValue] +12.0f; // convert from string to float plus some extra points because calculation is sometimes one line short 

bioWebView.frame = CGRectMake(bioWebView.frame.origin.x, bioWebView.frame.origin.y, bioWebView.frame.size.width, h); 

// get bottom of text field 
h = bioWebView.frame.origin.y + h + 70; // extra 70 pixels for UIButton at bottom and padding. 
[scrollView setContentSize:CGSizeMake(320, h)]; 

/* 

    position button code here.... 

    */ 

} 
関連する問題