What I’m actually trying to do is put a WebKitView into a ScreenSaver (which inherits NSView). I’m totally new to MacOS X and Cocoa (but I’m very familiar with Objective-C and used some parts of GNUStep). Do I need some laying out? I want to show only one control in the whole NSView.
Share
In your
initWithFrame:isPreview:method, create a WebView in the usual way, then, send yourself anaddSubview:message, passing the web view:If you’re wondering what rectangle you should pass as the WebView’s frame, read the View Programming Guide. Also, don’t forget to release the
webViewindealloc(or autorelease it ininitWithFrame:isPreview:).Once you have your web view, you’ll need to load a page into it. Set a suitably long animation interval (at least a couple of seconds), and load the page in
animateOneFrame:You may also want to handle
WebViewProgressFinishedNotification, and put off re-loading the web view until that happens (to compensate for slow or soaked connections). You’ll do this with an instance variable, which you set toYESin bothinitWithFrame:isPreview:and your notification-handler method, and test and set toNOinanimateOneFrame: