What is the difference between dealloc and viewdidunload?

When should I free up all the memory that I have allocated in my program?

Because I only have a viewDidLoad method, where I do my business. Should I leave dealloc empty and clear only in viewDidUnload?

+5
source share
2 answers

'dealloc' is used when the object is ready to be freed (i.e. when the object's hold value becomes 0). And viewDidUnload is called when the view is unloaded, but it cannot be immediately released, since the UIViewController link is still stored by some other objects.

: ojbects, "init", "dealloc", , "viewDidLoad", "viewDidUnload".

+8

-viewDidUnload :

, , . , , . , , DidLoad . , .

, , , IBOutlet Interface Builder. , , , viewDidLoad. - ( ) - nil. , , .

-viewDidUnload -dealloc, .

+4

All Articles