UIWebView will be empty when navigating to a view

I have an application that loads UIWebView. And it works well. The user can click the link in the web view, which then creates a new view controller / webview to download the link, which also works well.

Which doesn't work so well that sometimes (maybe 1/4), when I return to the original web view, the view is empty white.

The controller is not freed and does not receive warnings between memory. And I'm completely puzzled.

Does anyone know what is going on, and especially how to fix it?

Here are some methods that have something to do with the controllers:

Initial Controller:

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    if (navigationType == UIWebViewNavigationTypeLinkClicked)
    {
        WebView * wv = [[WebView alloc] initWithNibName:@"WebView" bundle:nil];
        UIBarButtonItem *backBar = [[UIBarButtonItem alloc] initWithTitle:@"Back to the Article" style:UIBarButtonItemStyleDone target:nil action:nil];
        self.navigationItem.backBarButtonItem = backBar;
        [backBar release];
        [[UIAppDelegate navigationController] pushViewController:wv animated:YES];
        [[wv webView] loadRequest:request];
        [wv release];
    }
    return NO;
}
else
    return YES;
}

Another controller (WebView):

- (void)viewDidLoad {
    [super viewDidLoad];
    [webView setDelegate:self];
}
+3
2

, ?

, .

+1

, :

[self.webView loadHTMLString:@"HTML GOES HERE" baseURL:[NSURL URLWithString:@""]];

:

[self.webView loadHTMLString:@"HTML GOES HERE" baseURL:nil];

, UIWebView ,

[[self navigationController] presentModalViewController:myModalViewController animated:YES];

nil baseURL: UIWebView -loadHTMLString: baseURL:. iOS 4.3 SDK.

0

Source: https://habr.com/ru/post/1710351/


All Articles