0

mainviewcontroller webview を 2 回目にリロードし、webview をリロードする必要があります。

APPDELGATE:

- (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 自体ではなく、webView の webViewDidFinishLoaded のデリゲートであるためです。

于 2012-04-27T17:48:42.713 に答える