Re: Documents & Controllers
Re: Documents & Controllers
- Subject: Re: Documents & Controllers
- From: Michael Rondinelli <email@hidden>
- Date: Fri, 15 Aug 2003 16:43:03 -0400
>
The first problem: Instead of loading data from a file and giving it
>
to
>
the webview to display, I instead need to get an absolute url
>
(file:///users/seth/Desktop/myHTMLFile.html) and pass *that* to the
>
webview. I couldn't figure this out because I didn't see any way to
>
get
>
the file url from the NSDocument, only the file's name. So problem #1
>
is, how do I get the file URL?
NSURL *fileURL = [NSURL fileURLWithPath:[myDocument fileName]];
>
The second and more disastorous problem is, how do I give that URL to
>
the WebView? Currently, the address field sends an action directly to
>
the window controller via the File Owner in the nib file. The action
>
it
>
calls is: - (IBAction)loadURL:(NSString *)address; (I know how to
>
obtain the absolute path string from a NSURL so lets just assume that
>
somehow in someway I end up with a local url for the file I want to
>
open.) So the question is, how do I call that action (pretty simple to
>
do),
Here's a method that will do it all:
- (void)showFile:(NSString *)htmlFile
{
[[webView mainFrame] loadRequest:
[NSURLRequest requestWithURL:[NSURL fileURLWithPath:htmlFile]]];
}
This was described in the WebKit documentation, which is included in
the SDK.
Best Wishes,
Michael
--
Michael Rondinelli
Chief Technology Officer
EyeSee360, Inc.
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.