Modify the font size in UIWebView

  1. 1. UIWebView set font size, color, font: 1. UIWebView set font size, color, font:  
  2. UIWebView cannot set some properties of fonts through its own properties, but can only set them through html codes. The code is as follows: UIWebView cannot set some properties of fonts through its own properties, but can only set them through html codes. The codes are as follows:  
  3. After the webView is loaded, in  
  4. - ( void )webViewDidFinishLoad: ( UIWebView  *) add js code to the webView method  
  5.     NSString *str = @"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '60%'";  
  6.     [_webView stringByEvaluatingJavaScriptFromString:str];  

or join

From: http://blog.csdn.net/daiyelang/article/details/23442909

[object]  view plain   copy
  Check out code snippets on CODE derived to my code slice
  1. NSString *jsString = [[NSString alloc] initWithFormat:@"document.body.style.fontSize=%f;document.body.style.color=%@",fontSize,fontColor];   
  2.         [webView stringByEvaluatingJavaScriptFromString:jsString];   

Guess you like

Origin blog.csdn.net/sirodeng/article/details/51535345