增加webview的字体大小与UIScrollView冲突

时间:2013-08-26 12:45:19

标签: iphone ios objective-c uiwebview

我在UIScrollView中有一个UIWebView。 我正在使用此代码来增加UIWebView的字体大小:

int fontSize = 150;
NSString *jsString = [[NSString alloc]      initWithFormat:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '%d%%'",     fontSize];
[LabelNewsContent stringByEvaluatingJavaScriptFromString:jsString];
NSString *size = [LabelNewContent stringByEvaluatingJavaScriptFromString:@"return      Math.max( \
document.body.scrollHeight, document.documentElement.scrollHeight, \
document.body.offsetHeight, document.documentElement.offsetHeight, \
document.body.clientHeight, document.documentElement.clientHeight  \
);"];
scrollview.contentSize = CGSizeMake(scrollview.contentSize.width, [size floatValue]);

字体增加没有任何错误,但UIWebView中只有一半文本可见。

0 个答案:

没有答案