Re: Who owns a child view controller?
Re: Who owns a child view controller?
- Subject: Re: Who owns a child view controller?
- From: Doug Hill <email@hidden>
- Date: Wed, 12 Jul 2017 15:18:26 -0700
> On Jul 12, 2017, at 2:57 PM, Jeremy Hughes <email@hidden>
> wrote:
>
>> On 12 Jul 2017, at 22:07, Quincey Morris
>> <email@hidden> wrote:
>>
>>> Or there's something else going on under the covers.
>>
>> Yes, you are correct, betting *against* this assumption is a really, really
>> terrible idea. Reasoning about the point at which objects actually
>> deallocate is a code smell.
>
> I’m trying to understand memory management so I can avoid retain cycles and
> other issues.
>
> …
>
> If I release the child view controllers of this top-level view controller (by
> assigning an empty array to childViewControllers), my expectation is that I
> don’t have to release every view controller and view in the hierarchy because
> they are effectively owned by the top-level view controller.
While this discussion has been good at understanding underlying ARC and manual
ref-count issues, my guess as to what's causing these issues is that you
shouldn't just assign nil to the childViewControllers array. You should try
calling:
childVC.removeFromParentViewController()
for each child view controller.
Hopefully this is the source of your object-ownership issues.
Doug Hill
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden