I've got a method which does something like this, feel free to pillage :)

- (BOOL)loadUntilDate:(NSDate *)date;
{
    BOOL result = NO;

    NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
    while (!result && [date timeIntervalSinceNow] > 0)
    {
        [runLoop runUntilDate:[NSDate distantPast]];
        result = ![self isLoading];
    }

    return result;
}


Where -isLoading should return whether your webview has loaded yet. Note that this is running in the default run loop mode which is your only public API option for now.

Mike.

On 5 Oct 2009, at 17:51, jon wrote:

i have a webView loading, and need to wait until it is finished loading...

so far i've set up this notification in the wakeFromNib:

NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; [center addObserver:self selector:@selector (webViewProgressFinished:) name:WebViewProgressFinishedNotification object:offScreenWebView];

and then i have a selector/method like so, with nothing in it, because i'm not sure what to put in it yet...

- (void)webViewProgressFinished:(NSNotification*)notification
{
        NSInteger i = 1;
}

and then i have a the main method that is running along, and at a certain point below i need to wait for that notification to fire... Or that method to fire... same thing... i need a little push in the correct direction, because i really am stumped in whether to use some sort of NSRunLoop, or NSEvent, or what would it be?

        URLToLoad = [NSURL URLWithString:theUrlString];
        [offScreenWebView setFrameLoadDelegate:self];
[[offScreenWebView mainFrame] loadRequest:[NSURLRequest requestWithURL:URLToLoad]];

        [[NSRunLoop currentRunLoop] runUntil... we get that darn message?];

here is where i need to wait until i get that message, or that that method is fired... I seem to have the selector firing correctly i believe ... but i don't know how to wait until it fires?
that is what i have so far...
and help would be appreciated greatly...

thanks,
Jon.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net

This email sent to cocoa...@mikeabdullah.net

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to