• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Creating WebView in code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating WebView in code


  • Subject: Re: Creating WebView in code
  • From: Jenny M <email@hidden>
  • Date: Fri, 2 Apr 2010 13:19:15 -0700

On Fri, Apr 2, 2010 at 9:40 AM, Nick Zitzmann <email@hidden> wrote:
> 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.
>

Yup, you're right. That was just something I saw in an example; I
changed it to load a plain test html file, and that seems to work fine
(aka it doesn't crash).


> 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.
>

D'oh, you told me that before and I completely forgot. So I tried
that, but the page still appears blank. I don't want the page to be
visible so I didn't set makeKeyOrderFront.

--------------------
NSRect frame = NSMakeRect(0.0, 0.0, pageSize.width, pageSize.height);
NSWindow *window = [[NSWindow alloc] initWithContentRect:frame
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered
defer:NO];

WebView *myWebView = [[WebView alloc] initWithFrame:frame
frameName:@"Test Frame" groupName:nil];
[[myWebView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL
URLWithString:@"http://www.jenstechs.net/test/testpage.html";]]];

[window setContentView:myWebView];
--------------------

I also tried setting the content view before loading the request, but
both still result in blank pages....


Sorry for not quite getting this yet, but I do hope this discussion is
useful for someone besides myself!

Thanks,
Jenny
_______________________________________________

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

  • Follow-Ups:
    • Re: Creating WebView in code
      • From: Nick Zitzmann <email@hidden>
References: 
 >Re: Creating WebView in code (From: Jenny M <email@hidden>)
 >Re: Creating WebView in code (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: How to save and restore NSScrollView scroll position?
  • Next by Date: Re: NSPredicate/NSExpression - can they solve this Core Data problem?
  • Previous by thread: Re: Creating WebView in code
  • Next by thread: Re: Creating WebView in code
  • Index(es):
    • Date
    • Thread