【发布时间】:2011-02-28 16:20:05
【问题描述】:
我正在通过此代码加载本地 html 页面:
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"title" ofType:@"html"];
NSData *htmlData = [NSData dataWithContentsOfFile:htmlFile];
[webView loadData:htmlData MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[NSURL URLWithString:@""]];
...它正在完美加载。我已经添加了链接标签来加载项目中添加的本地 css 文件,但它确实按预期加载了页面。
<head>
<link media="only screen and (max-device-width: 480px)" href="/style.css" type= "text/css" rel="stylesheet" />
</head>
但是当我从服务器加载带有 css 的本地 html 页面时,它会完美加载。
<head>
<link href="http://somehitng.com/stylesheets/style.css" media="screen" rel="stylesheet" type="text/css" />
</head>
谁能帮我解决我做错了什么?
【问题讨论】: