Change font size for web browsing in Iphone SDK

I use parsing and get the content as a string. Now I am making an html file through it programmatically. Upload this HTML to your web view. My webview is a preview in a Table View cell.

enter image description here

But now I want to change the font size of the contents of the web view so that the user can see some details.

My code for generating HTML:

NSString * postHTML=[[_parseResults objectAtIndex:indexPath.row]valueForKey:@"summary"]; NSString *close =[NSString stringWithFormat:@"</body></html>"]; NSString *HTMLString = [NSString stringWithFormat:@"%@%@", postHTML,close]; [Web_view loadHTMLString:HTMLString baseURL:nil]; [cell.contentView addSubview:Web_view]; return cell; 

How to resize web view content?

+4
source share
3 answers
 [myWeb loadHTMLString:[NSString stringWithFormat:@"<div style='text-align:justify; font-size:45px;font-family:HelveticaNeue-CondensedBold;color:#0000;'>%@%@",postHTML,close] baseURL:nil]; 

you can set the font size to font-size: size in the code.

try this .. i know it works or not !!!

+9
source

In UIWebView you can use all HTML tags when transferring data.

 [WebView loadHTMLString:[NSString stringWithFormat:@"<div style='text-align:justify; font-size:44px;font-family:HelveticaNeue-CondensedBold;color:#ffff;'>%@",Data] baseURL:nil]; 

Use the code above where "Data" will be your content.

Thanks,

Hemang.

+4
source

install in your html

 NSString *string = [NSString stringWithFormat: @"<html> \n" "<head> \n" "<style type=\"text/css\"> \n" "body {font-family: \"%@\"; font-size: %@;}\n" "</style> \n" "</head> \n" "<body>%@</body> \n" "</html>",@"Helvetica",[NSNumber numberWithInt:17], @"<p><i>My data</p>"]; 
+1
source

All Articles