What is the correct way to release UIWebView?

I searched a lot of code examples on the Internet. If I add a UIWebView from the interface constructor as an IBOutlet. Is it correct that in the dealloc method of the controller I need to do the following?

[webView stopLoading]; webView.delegate = nil; [webView release]; 

and what is in the viewDidUnload method?

+1
source share
2 answers

In reference to the UIViewController class , Apple recommends that for iOS 3.0 and later, you release links to objects that cannot be easily recreated.

In the same document, Apple also recommends releasing these links in dealloc.

The corresponding method documentation is located in the viewDidUnload section of the class reference; he details this and covers both viewDidUnload and dealloc.

0
source

This is a good way to handle this.

0
source

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


All Articles