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

  • Home
  • SEARCH
  • 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 8776217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:59:59+00:00 2026-06-13T18:59:59+00:00

I have a very basic container view that contains a sidebar and swaps out

  • 0

I have a very basic container view that contains a sidebar and swaps out the view controllers in the content area (think UISplitView but with a small icon sidebar / vertical UITabBar).

The container view controller uses autoLayout and resizes correctly when rotated.
Content viewController 1 uses autolayout and was made with IB, so it has a xib file.
Content viewController 2 inherits from UITableViewController and does not use a xib.

If I assign viewController 1 as the root view controller and rotate, the resize works and here are the callbacks that I get in viewController 1:

  • willRotateToInterfaceOrientation
  • updateViewConstraints
  • viewWillLayoutSubviews
  • didRotateFromInterfaceOrientation

However, if I assign my container view controller as the root view controller, load viewController 1 and rotate, the resize does not work. And I only get the following callbacks inside viewController 1:

  • willRotateToInterfaceOrientation
  • didRotateFromInterfaceOrientation

Inside my view controller container, here’s how I swap the view controllers:

[self addChildViewController:toViewController];
[toViewController didMoveToParentViewController:self];

// Remove the old view controller
[fromViewController willMoveToParentViewController:nil];
[fromViewController.view removeFromSuperview];
[fromViewController removeFromParentViewController];

// Add the new view
[self.contentContainerView addSubview:toViewController.view];

Now, I do get the callbacks that a rotation is about to happen, but it seems as if neither updateViewConstraints nor viewWillLayoutSubviews is called. This explains why the resize is not happening, but why are those methods not called once I put the view controller in a container view?

I also tried to explicitly return YES in my container on both

shouldAutomaticallyForwardAppearanceMethods

and

shouldAutomaticallyForwardAppearanceMethods

although this should be the default already.

Also, the view controller not made with IB (view controller 2) resizes correctly when rotating inside the container. However, I don’t explicitly use NSLayoutConstraints on this one, so I suspect it’s defaulting to Springs and Struts for the resizing when rotating.

Do I need to forward some other events on my view controller container to get the auto layout view controller to resize correctly when rotating?

  • 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-13T19:00:01+00:00Added an answer on June 13, 2026 at 7:00 pm

    OK, I think I was missing this method here in my view controller container:

    - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
        self.contentViewController.view.frame = self.contentContainerView.bounds;
    }
    

    While this resizes now correctly when rotating, it still doesn’t trigger

    updateViewConstraints
    

    in my child view controller. Interesting

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

Sidebar

Related Questions

I have a very basic mysql table called memberships, that tracks which people belong
I have some very basic semaphore code that works great on Linux, but cannot
I have a very basic doubt regarding the method that gets executed when app
I have a very basic data class that is subclassed from NSObject. I declare
I have a user control I have created that contains a details-view that I
I have an application that contains a main Activity, which has a very simple
I have a very basic container with a few children divs inside, displayed as
I have created a very basic custom layout to set out a menu made
I am using RazorEngine to render out some basic content (a very crude content
I have a question that could seem very basic, but it is in a

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.