Home > Web Front-end > HTML Tutorial > iOS加载本地HTML注意点_html/css_WEB-ITnose

iOS加载本地HTML注意点_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:14:54
Original
1324 people have browsed it

今天在做本地html的时候遇到了一些小问题 写下来分享给大家


1.关于导入文件

3C80CFC2-6E8E-497B-9D7A-E4FB298618A8.png

因为前段JS CSS 的调用有严格的页面结构 所以我们导入文件的时候尽量选择下面这种情况!当然如果前段代码跳转以及引用js css 并没有文件结构 选择第一种

2.关于加载html

当我们选择第二种方式导入文件后 ,之前的[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]]就不能找到html 的Index页了.应该用[[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html" subdirectory:@"html"];其中subdirectory就该写你index页的目录 如果有多层目录结构应写html/xxx还有一种方法就是直接拼接目录[[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/html/index.html"]


大家都是新手 多分享 多学习

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template