• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Who owns a child view controller?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Who owns a child view controller?
      • From: Jeremy Hughes <email@hidden>
References: 
 >Who owns a child view controller? (From: Jeremy Hughes <email@hidden>)
 >Re: Who owns a child view controller? (From: Jens Alfke <email@hidden>)
 >Re: Who owns a child view controller? (From: Jeremy Hughes <email@hidden>)
 >Re: Who owns a child view controller? (From: Jens Alfke <email@hidden>)
 >Re: Who owns a child view controller? (From: Charles Srstka <email@hidden>)
 >Re: Who owns a child view controller? (From: Jeremy Hughes <email@hidden>)
 >Re: Who owns a child view controller? (From: Jens Alfke <email@hidden>)
 >Re: Who owns a child view controller? (From: Jeremy Hughes <email@hidden>)
 >Re: Who owns a child view controller? (From: Steve Christensen <email@hidden>)
 >Re: Who owns a child view controller? (From: Quincey Morris <email@hidden>)
 >Re: Who owns a child view controller? (From: Jeremy Hughes <email@hidden>)

  • Prev by Date: Re: Who owns a child view controller?
  • Next by Date: Re: Who owns a child view controller?
  • Previous by thread: Re: Who owns a child view controller?
  • Next by thread: Re: Who owns a child view controller?
  • Index(es):
    • Date
    • Thread