Re: WebView open URL upon launch of application? (Having issues)
Re: WebView open URL upon launch of application? (Having issues)
- Subject: Re: WebView open URL upon launch of application? (Having issues)
- From: Erik Stainsby <email@hidden>
- Date: Sat, 28 Jul 2012 13:28:10 -0700
Try just moving the three statements you have in -awakeFromNib: into the other scope. This should move the invocation of the load request to after the webView has been fully instantiated.
On 2012-07-28, at 1:16 PM, Tom Miller <email@hidden> wrote:
> I found this snippet while looking for a way to launch a URL in WebView upon launch of an application. The code is running and building properly with the application, but the URL doesn't process in the WebView once the application opens. The Object I assigned to the 'window' and 'webView' are connected properly, so I'm very confused on why this won't load the URL. Any idea why this is happening?
>
>
>
>
> @interface ViewController: NSObject {
>
>
>
> NSWindow *window;
>
>
>
> IBOutlet WebView *webView;
>
>
>
> }
>
>
>
>
> @property (assign) IBOutlet NSWindow *window;
>
>
>
> @property (nonatomic, retain) IBOutlet WebView *webView;
>
>
>
>
>
> @end
>
>
>
>
> @implementation ViewController
>
>
>
> @synthesize window;
>
>
>
> @synthesize webView;
>
>
>
>
> - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
>
>
>
> }
>
>
>
>
> - (void)awakeFromNib {
>
>
>
> NSString *resourcesPath = [[NSBundle mainBundle] resourcePath];
>
>
>
> NSString *htmlPath = [resourcesPath stringByAppendingString:@"
> http://www.google.com"];
> [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:htmlPath]]];
> }
>
> --
> -
> Tom Miller
> email@hidden
> pxlc.me
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden