title: Resizing a WebView instance
body: <p>I'm just starting to learn OSX Cocoa app development. I would like to display a website inside a native OSX window. I thought a WebView would be the right way. I would like the webview to always take up 100% of the containing windows' size.</p>
  
  <p>After struggling a bit, I understand how to catch the 'window resize' event, but I have no clue how to resize the web view according to the windows new size.</p>
  
  <p>Here's what I have so far:</p>
  
  <p>AppDelegate.h</p>
  
  <pre><code>#import &lt;Cocoa/Cocoa.h&gt;
  #import &lt;WebKit/WebKit.h&gt;
  
  @interface AppDelegate : NSObject &lt;NSApplicationDelegate, NSWindowDelegate&gt;
  
  @property (assign) IBOutlet NSWindow *window;
  
  @property (weak) IBOutlet WebView *websiteWebview;
  
  @end
  </code></pre>
  
  <p>AppDelegate.m</p>
  
  <pre><code>#import "AppDelegate.h"
  
  @implementation AppDelegate
  
  - (NSSize) windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize
  {
      WebView *view = [self websiteWebview];
      [view setFrame:CGRectMake(0, 0, 1000, 1000)];
      return frameSize;
  }
  
  - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
  {
      [[self window] setDelegate:self];
      NSURL *url = [[NSURL alloc] initWithString:@"http://conradk.com"];
      NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
      [[[self websiteWebview] mainFrame] loadRequest:request];
  }
  
  @end
  </code></pre>
  
  <p>I thought calling <code>[view setFrame:CGRectMake(0, 0, 1000, 1000)]</code> would resize the web view as well, but it seems to not be the case.</p>
  
  <p>Any tips / hints please? Is a WebView the right way to do this? Thanks for your help!</p>