// 将html文件加入工程,
UIWebView *webview = [[UIWebView alloc] init];
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"htmlTest" ofType:@"html"];
NSString *htmlStr = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
[webview loadHTMLString:htmlStr baseURL:[NSURL URLWithString:filePath]];
[self.view addSubview:webview];
// 加载后html内容可能并不是自适应屏幕宽度,可以通过调整html文件中的宽度配置:
// 例如:
// <table width="720" border="0" cellspacing="0" cellpadding="0">
// 可改成
// <table width="100%" border="0" cellspacing="0" cellpadding="0">
转载请注明出处:http://blog.csdn.net/sevenquan