Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In your <a href="http://developer.apple.com/documentation/UserExperience/Reference/ScreenSaver/Classes/ScreenSaverView_Class/Reference/Reference.html#//apple_ref/occ/instm/ScreenSaverView/initWithFrame:isPreview:" rel="nofollow noreferrer"><code>initWithFrame:isPreview:</code></a> method, create a WebView in <a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/initWithFrame:" rel="nofollow noreferrer">the usual way</a>, then, send yourself an <code>addSubview:</code> message, passing the web view:</p> <pre><code>webView = [[WebView alloc] initWithFrame:frame]; [self addSubview:webView]; </code></pre> <p>If you're wondering what rectangle you should pass as the WebView's frame, read the <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/" rel="nofollow noreferrer">View Programming Guide</a>. Also, don't forget to release the <code>webView</code> in <code>dealloc</code> (or autorelease it in <code>initWithFrame:isPreview:</code>).</p> <p>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 <code>animateOneFrame</code>:</p> <pre><code>- (void) animateOneFrame { [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com/"]]]; } </code></pre> <p>You may also want to handle <code>WebViewProgressFinishedNotification</code>, 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 to <code>YES</code> in both <code>initWithFrame:isPreview:</code> and your notification-handler method, and test and set to <code>NO</code> in <code>animateOneFrame</code>:</p> <pre><code>- (void) animateOneFrame { if (hasFinished) { [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com/"]]]; hasFinished = NO; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload