Hi I'm displaying a multiline text inside a uiwebview.开发者_运维技巧 I'm using this instead of uitextview coz Im displaying some fancy symbols like degrees, superscript, subscripts, etc. My question is how can I fit all the text inside a fixed width and height of the uiwebview. Say, I have a uiwebview of 300x200 I want all the text to fit inside that view. see the image below to see my problem. http://i228.photobucket.com/albums/ee262/romano2717/photo.png
To resize the height & width try this -
webView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
self.webView.autoresizesSubviews = YES;
//Incase the above does not work.
NSString *jsCommand = [NSString stringWithFormat:@"document.body.style.zoom = 0.5;"];
[self.webView stringByEvaluatingJavaScriptFromString:jsCommand];
Hope this helps...
Set webView.scalesPageToFit
to YES.
精彩评论