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 9130643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:59:53+00:00 2026-06-17T07:59:53+00:00

I am using the containment API to create a custom container view controller Creation

  • 0

I am using the containment API to create a custom container view controller

Creation of Parent View Controller in ViewDidLoad of Parent, and Setting of Child View Controllers:

[self addChildViewController:newA];
[self addChildViewController:newB];
[self addChildViewController:newC];

Now once these childVC have been added I can transition using:

[self transitionFromViewController:from
                  toViewController:to
                          duration:1.0
                           options:UIViewAnimationOptionTransitionFlipFromLeft
                        animations:nil
                        completion:^(BOOL b){
                            [to didMoveToParentViewController:self];
                            [from.view removeFromSuperview];
                            [from removeFromParentViewController];
                        }];

My question now is must I remove the current childVC from the parentVC to show the new VC?

                        completion:^(BOOL b){
                            [to didMoveToParentViewController:self];
                            [from.view removeFromSuperview];
                            [from removeFromParentViewController];
                        }

Is there a way that I can preserve those childVCs’ and simply do swipe/button-action to then navigate between these childVCs’?

  • 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-17T07:59:54+00:00Added an answer on June 17, 2026 at 7:59 am

    So you don’t need to remove the from view controller’s view from the view hierarchy manually. This method handles that for you upon completion of your animation block. From the docs on this method:

    This method adds the second view controller’s view to the view
    hierarchy and then performs the animations defined in your animations
    block. After the animation completes, it removes the first view
    controller’s view from the view hierarchy.

    As a caveat to this, though, the animation block cannot be NULL as it is in your code example (that being said, you have nil, not NULL, which doesn’t make sense since the animations parameter is a block, not an Objective-C object).

    UPDATE: Depending on your implementation, viewDidLoad may get called repeatedly if the memory for that view is cleaned up. A UITabBarController, for instance, generally only calls viewDidLoad upon adding your VC’s to the tab bar, and just calls viewWill/DidAppear after that. Similarly, a UINavigationController won’t call viewDidLoad when you pop to a view controller because it’s been maintaining it in its navigation stack, but will call viewDidLoad if you pop off of a VC and then push it back on (usually). If you’re not getting the behavior you want, you can subclass this method in your container implementation.

    ** NOTE I am removing the iphone-sdk-4.0 tag from your question, as the containment API did not become available until 5.0

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

Sidebar

Related Questions

I have 1 Parent Controller and 1 View Controller. I have successfully performed the
I'm using the JQuery Draggable plugin . I'm trying to create an Image Editing
The jQuery UI Draggable interaction has a nice property for setting the containment as
I am having trouble setting the containment value of the jqueryUI draggable function when
I'm using Symfony 2 with doctrine. I've set up a custom repository with a
I am using function example_append() { $('#containment').append($('#example-textarea').val()); } This is throwing the text I
I am using jquery.viewport to create an viewport function: I use jquery ui to
I have something like a modal view controller that I need to display above
Background Create a series of SQL JOIN statements using two operands: primary and secondary.
Reading several guidelines for jQuery performance I discovered this functionality: Instead of doing: $('#legendGallery).draggable({containment:'#container'});

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.