Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9116437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:40:21+00:00 2026-06-17T04:40:21+00:00

I have 1 Parent Controller and 1 View Controller. I have successfully performed the

  • 0

I have 1 Parent Controller and 1 View Controller. I have successfully performed the addChildViewController and transitionFromViewController functions to leverage the Containment API provided by iPhone SDK. Yet before I can actually pass view controllers to those functions I have a few questions

Question 1: In the ParentVC ViewDidLoad method must I instantiate all 4 child view controllers using the following

UIViewController* child = [self.storyboard instantiateViewControllerWithIdentifier:identifier];

OR self.myViewController = [[MyViewController alloc] init];

Question 2: Assuming I do not instantiate all 4 child views initially in my ViewDidLoad… each time I add a new child using addChildViewController before I perform a transition using transitionFromViewController, am I required to instantiate the child VC I am desiring to add?

Question 3: Under the condition that the answers to Question 1 and/or Question 2 are ‘Yes’ what must be done about memory management. For Question 1, when navigating back to the parent VC from a child VC, it seems to mean that a new objects of the 4 child view controllers will be created, correct? When looking at Question 2, when transitions are made, which can be often, it seems to create a new copy of the child view controller objects each time. In essence this app could become very bloated after some transitions between parent and child, and between child and child views.

Question 4: When transitionFromViewController is being called, what is happening in memory? What happens to the parent VC in a parent-child transition? What happens to the child VC in a child-child transition?

UPDATE: The following quote from this particular tutorial seems to refer to some of my concerns (emphasis added):

Note that self.storyboard isn’t set from an init call. At the moment,
there isn’t a great place to put this initialization code. One option
is to override setStoryboard: and another is viewDidLoad. The problem
with both options is that you should guard the addChildViewController:
call to make sure that View Controllers aren’t instantiated twice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:40:22+00:00Added an answer on June 17, 2026 at 4:40 am
    1. No, you don’t need to instantiate all the children in the custom container view controller’s viewDidLoad if you don’t want. You can if you want, but you don’t have to. You can instantiate them in a just-in-time manner if you would prefer.

    2. Not only would you need to instantiate before transitionFromViewController, but obviously before addChildController, too.

    3. If you choose to instantiate all of the view controllers up front, what member objects are created by the individual controllers is a function of how you handle it in those controllers, so it’s impossible to answer that in the abstract. But this might be academic now that you know you don’t have to instantiate all of the potential children at once.

    4. transitionFromViewController will not affect the memory consumed by the controllers. What controls that would be the instantiating of the controller (and adding it to addChildViewController) and the subsequent removeFromParentViewController (assuming that’s the last strong reference you have to the controller) that you might do in conjunction with transitionFromViewController.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have parent view that also renders sub-controller action using RenderAction() (that returns a
If I have a parent view controller that displays a modal view with a
I'm attempting to switch views with an iPhone application- I have a parent view
I have an initial 'parent menu' view controller with a 'photos' button (more buttons
I have a parent view controller that supports all four orientations. It presents a
so i have a Parents controller with list and edit view for it (to
Just wondering if there is a way in Spring to have a parent controller:
I have a nested form Parent, which accepts attribute for Child. In my controller#new,
I have a view controller, which creates 2 view controllers inside it. Inside each
I'm writing an iPhone app. Starting from a view controller in a navigation stack

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.