I am displaying html mails in my app. But it does not stretch images to full size while apple's mail app does. see screenshots below. How apple is Any idea how to achieve this?
- My Application web view
Apple's mail app
I am displaying html mails in my app. But it does not stretch images to full size while apple's mail app does. see screenshots below. How apple is Any idea how to achieve this?
Apple's mail app
You might try playing with the viewport metatag in the HTML. Even if you can't modify the HTML before it's loaded, you can add / adjust this tag after the fact.
I answered a question about how to accomplish this here:
I know this doesn't answer your question, but Apple explicitly warns against embedding UIWebViews in UIScrollViews in the UIWebView Class Reference
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.
But for what it's worth, have you tried the scalesPageToFit property of UIWebView?
Not sure where I have this but it was in my notes.
You need to do a bit of JS work in order it to fit once it has been rendered.
#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....
*/
}