Re: Creating WebView in code
Re: Creating WebView in code
- Subject: Re: Creating WebView in code
- From: Nick Zitzmann <email@hidden>
- Date: Fri, 2 Apr 2010 10:40:33 -0600
On Apr 1, 2010, at 8:17 PM, Jenny M wrote:
> Great, I'm testing that method now. I get everything built alright,
> but during the print operation (while the print panel is shown), the
> program crashes with the following message in the console:
>
> -----------------
> Debugger() was called!
> The Debugger has exited due to signal 2 (SIGINT).The Debugger has
> exited due to signal 2 (SIGINT).
> -----------------
That's most likely Flash Player at work, since it's been known to do this. To work around it, install a dummy SIGINT handler function that does nothing. See the signal man page for details.
> Now, when the print panel IS shown, the preview is blank, so I know
> it's not loading but I can't tell where. Here's the code I'm using..
> ------------------
> NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
> NSSize pageSize = [printInfo paperSize];
> NSRect frame = NSMakeRect(0.0, 0.0, pageSize.width, pageSize.height);
> WebView *myWebView = [[WebView alloc] initWithFrame:frame
> frameName:@"Test Frame" groupName:nil];
> [[myWebView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL
> URLWithString:@"http://nytimes.com"]]];
> NSView *printView = [[[myWebView mainFrame] frameView] documentView];
You must place the WebView in a window or else it won't render. It's a dumb but necessary requirement. So you'll need to also create an NSWindow and add the WebView as a subview of its content view, and that ought to work.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden