Hi
I'm trying to make a button load a local HTML file in a webView on my OSX App. My current code is:
And this does not load the file "index.html". I've being trauling the forums, but can't see anything similar, though I know it must be quite simple. Does anybody have any ideas as to what's wrong with that code?
Sorry if this is in the wrong place - I wasn't sure where to put it.
Thanks in advance,
Sam
I'm trying to make a button load a local HTML file in a webView on my OSX App. My current code is:
Code:
- (IBAction)returnHome {
[webView setUIDelegate:self];
NSURL *url = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html"];
NSString *html = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];
NSURL *baseUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]];
[[webView mainFrame] loadHTMLString:html baseURL:baseUrl];
}
And this does not load the file "index.html". I've being trauling the forums, but can't see anything similar, though I know it must be quite simple. Does anybody have any ideas as to what's wrong with that code?
Sorry if this is in the wrong place - I wasn't sure where to put it.
Thanks in advance,
Sam