views:

386

answers:

2

Hi

I have an app that loads a UIWebView. And that works well. It is possible for the user to click a link in the web view which then creates a new view controller/web view to load the link, which also works well.

What isn't working so well, is that sometimes (1/4 maybe) when I come back to the initial web view, the view is blank white.

The controller is not being dealloced, and is not receiving memory warning in between. And I'm totally puzzled.

Anyone know what's going on, and more especially, how to fix it?

Here are any methods that have anything 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;
}

Other controller (WebView):

- (void)viewDidLoad {
    [super viewDidLoad];
    [webView setDelegate:self];
}
A: 

Are you sure it's not receiving a memory warning?

It might not be obvious when this occurs.

Elliot
I think that this was the case.
Carl
A: 

How did you deal with the memory warning in this case? I am seeing similar on my web view.

Fin