iphone webView上手动编辑HTML网页~~

-(void)viewDidLoad{
	NSString *htmlContent = @"<div style =\" font-family:Helvetica,Arial,sans-serif;font-size:10pt;\" align=\"center\">";
	NSMutableString *htmlPage = [NSMutableString new];
	[htmlPage appendString:htmlContent];
	[htmlContent release];

	[ htmlPage appendString:@"视频监控信息统计"];
	[ htmlPage appendString:@"<p>"];
	[ htmlPage appendString:@"</ span"];
	[ htmlPage appendString:@"<table cellspacing=0 cellpadding=8 border = 1>"];
	
	[ htmlPage appendString:@"<tr>"];
		[ htmlPage appendString:@"<td>"];
			[ htmlPage appendString:@"节目名"];
		[ htmlPage appendString:@"</td>"];
		[ htmlPage appendString:@"<td>"];
			[ htmlPage appendString:@"系统层"];
		[ htmlPage appendString:@"</td>"];
		[ htmlPage appendString:@"<td>"];
			[ htmlPage appendString:@"视频层"];
		[ htmlPage appendString:@"</td>"];
		[ htmlPage appendString:@"<td>"];
			[ htmlPage appendString:@"音频层"];
		[ htmlPage appendString:@"</td>"];
	[ htmlPage appendString:@"</tr>"];
	
	[ htmlPage appendString:@"<tr>"];
		[ htmlPage appendString:@"<td>"];
			[ htmlPage appendString:@"娱乐"];
		[ htmlPage appendString:@"</td>"];
		[ htmlPage appendString:@"<td>"];
			[ htmlPage appendString:@"0"];
			[ htmlPage appendString:@"<image src='green.gif'/>"];
		[ htmlPage appendString:@"</td>"];
		[ htmlPage appendString:@"<td>"];
			[ htmlPage appendString:@"2310"];
		[ htmlPage appendString:@"</td>"];
		[ htmlPage appendString:@"<td>"];
			[ htmlPage appendString:@"0"];
		[ htmlPage appendString:@"</td>"];
	[ htmlPage appendString:@"</tr>"];
	
	[ htmlPage appendString:@"</table>"];
	[webView loadHTMLString:htmlPage baseURL:nil];
	[htmlPage release];
	[super viewDidLoad];
}


         int height = webView.frame.size.height;
	
	NSString *html = [NSString stringWithFormat:@"<html><head><style>div{height:%dpx;}</style></head><body style='margin:0px'><div style='background-color:#FF0000;'></div><div style='background-color:#FFFF00;'></div><div style='background-color:#FF0F00;'></div><div style='background-color:#F00F00;'></div><div style='background-color:#0FFF00;'></div></body></html>",height];
	[webView loadHTMLString:html baseURL:nil];
	UIScrollView *scrollView = [webView.subviews objectAtIndex:0];
	if (scrollView && [scrollView isKindOfClass:[UIScrollView class]]) {
		scrollView.pagingEnabled = YES;


你可能感兴趣的:(html,image,table,iPhone,div,border)