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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:10:38+00:00 2026-06-14T12:10:38+00:00

Consider a container view controller with two child view controllers (A and B), both

  • 0

Consider a container view controller with two child view controllers (A and B), both added with addChildViewController:. Then:

  1. A.view is added to the container view
  2. B is displayed by doing transitionFromViewController from A to B. B receives viewWillLayoutSubviews and all is good with the world.
  3. The device rotates while displaying B. Only B receives the rotation calls (willRotateToInterfaceOrientation: et all).
  4. A is displayed by doing transitionFromViewController from B to A. A doesn’t receive viewWillLayoutSubviews and thus the layout is broken.

Is this the expected behavior? If not, what might I be doing wrong? If yes, what should I do to notify A of the rotation change while displaying B?

  • 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-14T12:10:39+00:00Added an answer on June 14, 2026 at 12:10 pm

    As soon as you call addChildViewController: you are now a View Controller Container Implementer. This means you do have to do a little more work than a standard presentation call like presentViewController... This includes dealing with the frames of the views of the controllers you add as children, as your question suggests you might have expected.

    For example, to implement a super basic example container, that just shows each child full screen, you could do something like this.

    -(void)swapChildVCFrom:(UIViewController *)from to:(UIViewController *)to{
        [self addChildViewController:to];
        [from willMoveToParentViewController:nil];
    
        // Adjust the new child view controller's view's frame
        // For example here just set it to fill the parent view
        to.view.frame = self.view.bounds;
    
        [self transitionFromViewController:from
                          toViewController:to
                                  duration:1.0
                                   options:UIViewAnimationOptionTransitionFlipFromLeft
                                animations:nil
                                completion:^(BOOL b){
                                    [to didMoveToParentViewController:self];
                                    [from.view removeFromSuperview];
                                    [from removeFromParentViewController];
                                }];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I ran across a compilation issue today that baffled me. Consider these two container
Consider the following HTML/css code sample: <div id="container"> <div id="up">Text<br />Text<br />Text<br /></div> <div
Consider the following two Java files that contain a simplified version of my issue
Consider my parent div is parentDiv and it contains five child divs <div id=parentDiv>
What would anyone consider the most efficient way to merge two datasets using Python?
Consider a UIViewController whose view contains the view of another UIViewController . Is it
Consider this Django view which will get a list of items associated to the
Consider this simplified view of some code with which I'm working: @Stateless(...) @Remote(...) @TransactionAttribute(TransactionAttributeType.MANDATORY)
The controller should ideally be free from domain logic right? How does that match
Consider the following code in a view: <%= link_to 'Delete!', item , :confirm =>

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.