Tag: Cocoa/WebViewの組み込み
objective c - How to load URL on launch in a WebView (OSX project)? - Stack Overflowに解説がある。
#import <Cocoa/Cocoa.h> #import <WebKit/WebKit.h> @interface AppDelegate : NSObject <NSApplicationDelegate> @property (weak) IBOutlet WebView *myWebView; @end
#import "AppDelegate.h" @interface AppDelegate () @property (weak) IBOutlet NSWindow *window; @end @implementation AppDelegate - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application [[self.myWebView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.softantenna.com/"]]]; } - (void)applicationWillTerminate:(NSNotification *)aNotification { // Insert code here to tear down your application } @end