0

In my iPhone application I am using HTML tags to show the data in table format but I have to reduce font for the same. This is my code

- (void) setStats:(NSArray*)stats {
NSString * htmlString;
if ( [UIHelper isPad] )
    htmlString = @"<html><style type=\"text/css\">body{padding:15px 40px 0 40px; font-family: Helvetica;"
    "font-size: 16px;"
    "color: #888888"
    "},</style><body><table cellpadding=4>";
else
    htmlString = @"<html><style type=\"text/css\">body{padding:8px 20px 0 20px; font-family: Helvetica;"
    "font-size: 11px;"
    "color: #888888;"
    "},</style><body><p align=\"left\">";

for ( NSDictionary *val in stats ) {
    NSString *statTitle = [NSString stringWithFormat:@"%@", [val objectForKey:@"title"]];
    NSString *statValue = [NSString stringWithFormat:@"%@", [val objectForKey:@"value"]];
    NSString * str = [NSString stringWithFormat:@"<tr><td width=\"60%%\">%@</td><td width=\"40%%\">%@</td></tr>", statTitle, statValue];

    htmlString = [NSString stringWithFormat:@"%@%@", htmlString, str];
}
htmlString = [NSString stringWithFormat:@"%@%@", htmlString, @"</table></body></html>"];

if ( [contentView respondsToSelector:@selector(loadHTMLString:baseURL:)] )
    [contentView loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"http://www.secondprizm.com"]];
}
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Nishi
  • 683
  • 1
  • 12
  • 31
  • Try this link may be help you, http://stackoverflow.com/questions/449773/iphone-development-setting-uiwebview-font – Anki Oct 12 '12 at 10:50
  • There is not really HTML in your question. Why do people don't post HTML but some kind of (pseudo-)code when asking HTML questions? – feeela Oct 12 '12 at 11:12

0 Answers0