0

我必须第二次重新加载 mainviewcontroller webview 并重新加载 webview。

应用程序:

- (void) webViewDidFinishLoad:(UIWebView*) theWebView 
{


    // only valid if FooBar.plist specifies a protocol to handle
    if (self.invokeString)
    {
        // this is passed before the deviceready event is fired, so you can access it in js when you receive deviceready
        NSString* jsString = [NSString stringWithFormat:@"var invokeString = \"%@\";", self.invokeString];
        [theWebView stringByEvaluatingJavaScriptFromString:jsString];

    }else {



         if([loginComplete isEqualToString:@"1"] ){


            NSString *page = @"intro.html";
            NSString* jsString = [NSString stringWithFormat:@"loadParams('%@','%@','%@');", at,userfbid,page];
            [theWebView stringByEvaluatingJavaScriptFromString:jsString];

        }

        else {
            NSString *page = @"friends.html";
            NSString* jsString = [NSString stringWithFormat:@"loadParams('%@','%@','%@');", at,userfbid,page];
            [theWebView stringByEvaluatingJavaScriptFromString:jsString];
        }


        // Black base color for background matches the native apps
        theWebView.backgroundColor = [UIColor grayColor];

        return [self.viewController webViewDidFinishLoad:theWebView];
    }




 -(void)insert{

        self.viewcontroller.webview.delegate=self;

        }

Webdelegate 未在插入中触发。

谢谢

4

1 回答 1

0

尝试这个:

return [self webViewDidFinishLoad:theWebView];

代替:

return [self.viewController webViewDidFinishLoad:theWebView];

因为您的 AppDelegate 是 webView 的 webViewDidFinishLoaded 的委托,而不是 webView 本身。

于 2012-04-27T17:48:42.713 回答