0
votes

I'm studying memory managment in UIviewController, i'm a little confused, the important points to remember are:

  • viewDidLoad is called every time the view is shown, here I alloc variables of any kind.
  • viewDidUnload is called in case of low memory, I set all the property to nil.
  • dealloc, I release all property.

Is it all right?

Also, if I don't link a label to a IBOutlet, have I a memory leak or the system dealloc it anyway?

1

1 Answers

0
votes

No. -viewDidLoad is called when the controller loads its view, not every time the view is displayed. Perhaps you're thinking of -viewWillAppear. Otherwise, your points are about right.

If you don't connect something to an outlet, the outlet will simply remain nil -- there's no leak. The label will generally be retained by its enclosing view, and will be released when the rest of the view hierarchy is released.