小竹小站:www.chinadev.cn
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { [webViewsetUIDelegate:self]; } - (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request { NSLog(@"sss%@",sender); NSUInteger windowStyleMask = NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask | NSTitledWindowMask; NSWindow * webWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600) styleMask:windowStyleMask backing:NSBackingStoreBuffereddefer:NO]; WebView * newWebView = [[WebView alloc] initWithFrame:[webWindow contentRectForFrameRect:webWindow.frame]]; [newWebView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; [webWindow setContentView:newWebView]; [webWindow center]; [webWindow makeKeyAndOrderFront:self]; [[newWebView mainFrame] loadRequest:request]; return newWebView; }