How to change string font in webview

I am creating an application for the iPhone in which on one of the UIWebView I show a line, for example, "Example". I want to change its font. I also used the html concept to change the font, but using this, it changes all the other lines that are on this UIWebView . But I want to change only the "Example" font and size. How can i do this. If anyone knows about this, please help me.

Thank you very much.

+4
source share
3 answers

You can do this with the following code, assuming you put this line between the elements and it is the first on the page. If this is not the case, customize according to your convenience.

 NSString *strFontIncrease = [[NSString alloc] initWithFormat:@"document.getElementsByTagName('span')[0].style.webkitTextSizeAdjust= '%f%%'",yourFontValue]; [webView stringByEvaluatingJavaScriptFromString:strFontIncrease]; [strFontIncrease release]; 

Check out and let me know if there is any doubt.

+3
source

Have you tried something like:

  <font size="5" face="arial" color="red"> This paragraph is in Arial, size 5, and in red text color. </font> 

Visit: http://www.w3schools.com/html/html_fonts.asp

0
source
 test test test <span style="background: blue; color: white; font-size:30px;">test test test</span>test test test 

This is not iPhone related programming .: D

0
source

All Articles