0

I have a uiwebview that I connect via IB to my UIViewController. In the controller.h, I define

@property (nonatomic, unsafe_unretained) IBOutlet UIWebView *myUIWebView;

I'm compiling for iOS 4.3, so I need the unsafe_unretained (otherwise I would use weak)

I've set the delegate of the UIWebView to be the UIViewController in IB.

If the controller gets didReceiveMemoryWarning while not being displayed (i.e. I'm on the next screen), the webView is ok (pointing to a valid webView) just before [super didReceiveMemoryWarning] , and becomes a Zombie right after the call . Is this normal? I've read that Because it is now a Zombie, I can't set it's delegate to nil in the controller dealloc.
So if it is "normal" that it is a Zombie, should I set the delegate to nil in dealloc ?

thanks

4

1 回答 1

0

将委托设置为零viewWillUnloadviewDidUnload类似-

- (void)viewWillUnload {
    [webView setDelegate:nil];
}
于 2012-05-22T19:01:41.070 回答