在我的iPhone应用程序中,我使用HTML标签以表格格式显示数据,但我必须减少相同的字体。这是我的代码
- (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"]];
}