Specifically -- how do you get all the assets to load from their respective directories (images/, css/, js/) without changing the content of the original HTML (removing directories)?
I am using this code to load index.html into the UIWebview:
NSURL *url = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html"];
NSString *html = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];
NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
[webView loadHTMLString:html baseURL:baseURL];
Then my html looks like this:
...
<link rel="stylesheet" type="text/css" href="css/main.css" />
<script type="text/javascript" src="js/classes.js"></script>
<script type="text/javascript" src="js/animate.js"></script>
etc...
If I remove the js/, css/, and images/, everything works because iOS thinks everything is in the root of my bundle. But, that means I cant use the same code across projects without dumping it all into one directory (lame). The engineer in me can't deal with this kind of disorganization.
Thanks in advance.