Monday, 26 August 2013

Increasing the font size of a webview conflict with UIScrollView

Increasing the font size of a webview conflict with UIScrollView

i have a UIWebView inside a UIScrollView. I am using this code to increase
the font size of the 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]);
The font increase happens without any errors but only half of the text
inside the UIWebView is visible.

No comments:

Post a Comment