Quote:
Originally Posted by starwarsdevwookie59
Thanks so much for your reply!
I was able to get the index.html to load in the webview and use the sources. here's the code I ended up using:
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
NSData *htmlData = [NSData dataWithContentsOfFile:filePath];
if (htmlData) {
NSBundle *bundle = [NSBundle mainBundle]; NSString *path = [bundle bundlePath]; NSString *fullPath = [NSBundle pathForResource:@"index" ofType:@"html" inDirectory  ath];
[web loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:fullPath]]]; }
I got it to load in the webview, just one problem... IT DOESNT RESPOND TO ANYTHING. It loads great with all the images and such, just when i click/touch something, it doesn't do anything.
Any help is appreciated. thanks.
|
I feel particularly generous today, here's my code that works.. I think you are missing the base uril for one thing.
NSString *filePathString = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
NSMutableString *html = [[NSMutableString alloc] initWithContentsOfFile: filePathString];
[html replaceOccurrencesOfString: @"urlvar" withString:urlString
options: NSLiteralSearch range: NSMakeRange(0, [html length])];
// NSLog(html);
NSURL *aURL = [NSURL fileURLWithPath:filePathString];
[webView loadHTMLString:html baseURL:aURL];