1

I am using a view controller that has several containers in it, and each container has its own view controller.

I want to know if [topMostViewController removeFromParentViewController]

will also remove all of its children, so that I don't have any memory leaks, or before that happens i also need to call removeFromParentViewController on all the children it has?

Lena Bru
  • 13,521
  • 11
  • 61
  • 126
  • If you're using ARC you shouldn't need to worry about this...is your app using ARC, or MRC (manually memory managed?) – lxt Mar 23 '14 at 16:00
  • ARC (some long text to fullfil requirement for minimum message even though 3 letters are enough) – Lena Bru Mar 23 '14 at 16:03
  • so you're saying topmost view controller will call viewDidDisappear on its on on all of its children? – Lena Bru Mar 23 '14 at 16:04

1 Answers1

0

removeFromParentViewController removes the child from its parent. Any children of the child will remain related to the child. If you've set up your relationships correctly all your children will have viewWillDisappear, etc called (if you've set up the relationships).

But because you're using ARC, you shouldn't need to care about memory leaks, because the compiler will take care of this for you.

lxt
  • 31,146
  • 5
  • 78
  • 83
  • memory leaks -> uiactivityindicator that wasnt shut off, uianimation that wasnt shut off etc, those will be gone too ? – Lena Bru Mar 23 '14 at 18:55