UIStepper in UIWebView - iOS
-
24-06-2021 - |
Question
I have been looking to use a UIStepper to increase and decrease font size in a WebView.
[webview stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '140%'"];
I want it so when I press the plus it takes it increases font size by 40% and when you press the minus it decreases the font size by 40%. So if I press the plus then the minus it takes it back to how it was and if i press the minus again it decreases the font size another 40%.
Thanks in advance!
Solution
textFontSize = 140;
NSString *jsString = [[NSString alloc] initWithFormat:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '%d%%'",
textFontSize];
[self.articleWebView stringByEvaluatingJavaScriptFromString:jsString];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow