适合uiwebview内的文字

时间:2011-09-18 13:46:03

标签: iphone ios xcode uiwebview

您好我在uiwebview中显示多行文字。我正在使用它而不是uitextview因为我显示了一些花哨的符号,如度,上标,下标等。我的问题是如何在uiwebview的固定宽度和高度内拟合所有文本。说,我有一个300x200的uiwebview我希望所有文本都适合该视图。看到下面的图像,看看我的问题。 http://i228.photobucket.com/albums/ee262/romano2717/photo.png

2 个答案:

答案 0 :(得分:0)

调整高度&尝试这个 -

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];

希望这会有所帮助......

答案 1 :(得分:0)

webView.scalesPageToFit设为是。

相关问题