Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change font size for web view in Iphone SDK

I have implementing feed parsing & get the content as a string. Now, I am making html file through it programetically. Load that HTML in the Web view. My web View is the subview in Table View cell.

enter image description here

But Now i want to change the font size of web view content, so the user can see some detail .

My code for HTML generation is:

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 can i change font size of web view content??

like image 566
user1673099 Avatar asked Dec 08 '22 19:12

user1673099


2 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 font size in font-size:size in code.

try this..let me know it is working or not!!!

like image 186
NiravPatel Avatar answered Dec 11 '22 07:12

NiravPatel


In UIWebView, you can use all HTML Tags while passing the data.

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

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

Thanks,

Hemang.

like image 20
Hemang Avatar answered Dec 11 '22 09:12

Hemang