Search code examples
iosobjective-cuiviewuiviewcontrollerpushviewcontroller

Show a UIViewController when she stop loading (webViewDidFinishLoad) in Objective-C


I have one UIViewController subclass called ThemeView. When I click on 1 button, it initiates an instance of a second UIViewController subclass called ViewJeuSolo and displays it.

-(IBAction) boutonJouer:(id)sender{

    //Do something

    ViewJeuSolo *secondViewController =
    [self.storyboard instantiateViewControllerWithIdentifier:@"ViewJeuSolo"];


    [self.navigationController pushViewController:secondViewController animated:YES];

}

So this works. My issue: there is a WebView in ViewJeuSolo and I want to show a spinner, load the WebView and after that do the

[self.navigationController pushViewController:secondViewController animated:YES];

I already have a

- (void)webViewDidFinishLoad:(UIWebView *)wva

But I can't see how to connect this function to my previous view.

Summary: I want to switch view only when the WebView in the new view has loaded.


Solution

  • For people who have the same issue,i do this:

    Put all the fonction for load the webview in you're first view. When you need to change view, load the web view in hidde and show the spinner. When the web view was load, init the next view and give the webview by a setwebview() function.

    Is work fine for me :). If you need more precision, tell me. Thanks all for you're help.