When I try this code, I get the error:
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_WebView", referenced from: objc-class-ref in AppController.o
webview=[[WebView alloc]initWithFrame:CGRectMake(0, 0, 100,30)];
NSString *url=@"http://www.google.com";
NSURL *nsurl=[NSURL URLWithString:url];
NSURLRequest *nsrequest=[NSURLRequest requestWithURL:nsurl];
[webview.mainFrame loadRequest:nsrequest];
[self.webViewMenuItem setView:webview];
webViewMenuItem is a NSMenuItem linked through an IBOutlet.
Ok for the sake of completing this question :
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_WebView", referenced from: objc-class-ref in AppController.o
Thats because Webkit framework was not added to project.
Is it possible to load a webview into a NSMenuItem in OS X
Yes its possible, but make sure to load the webview once parent view is done loading completely.