开发者

fit text inside uiwebview

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜