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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:28:11+00:00 2026-06-05T00:28:11+00:00

I have an issue with the orientation of my container controller. When switching between

  • 0

I have an issue with the orientation of my container controller.

When switching between controllers the previous controller tends to stay in whatever orientation it left off in when you switch back.

orientation bug

First, the steps I use to reproduce:

  1. When the container controller is presented I rotate to landscape.
    Everything looks fine in landscape at this point.
  2. Switch to child controller #2 via the segmented control.
  3. Rotate back to landscape in this view. Everything still looks normal.
  4. Switch back to child controller #1.

in ContainerController’s viewDidLoad:

self.child1 = [self.storyboard instantiateViewControllerWithIdentifier:@"first"];
self.child2 = [self.storyboard instantiateViewControllerWithIdentifier:@"second"];

[self addChildViewController:self.child1];
[self addChildViewController:self.child2];

[self.view addSubview:self.child1.view];

How I transition the child controllers:

- (IBAction)segmentChanged:(id)sender
{
    UIViewController *toVc, *fromVc;
    UISegmentedControl *segment = sender;

    if (segment.selectedSegmentIndex == 0)
    {
        toVc = self.child1;
        fromVc = self.child2;  
    }
    else
    {
        toVc = self.child2;
        fromVc = self.child1;
    }

    [toVc willMoveToParentViewController:self];
    [self transitionFromViewController:fromVc 
                      toViewController:toVc 
                              duration:0.0
                               options:UIViewAnimationOptionTransitionNone 
                            animations:nil
                            completion:^(BOOL finished){
                                [toVc didMoveToParentViewController:self];
                            }];
}

I had assumed transitionFromViewController would take care of all of that automatically. Does anyone know what I am doing wrong?

  • 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-05T00:28:13+00:00Added an answer on June 5, 2026 at 12:28 am

    A quick solution would be to add the following line before transtionFromViewController function is called

    toVc.view.frame = self.view.bounds;
    

    this should set the frame in the new view correctly

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

Sidebar

Related Questions

I have a really strange orientation issue. I have a sequence of view controllers
I had the orientation issue when working with ACTION_IMAGE_CAPTURE activity. I have used the
I have an issue with a View Controller which is loaded from a NIB.
I have an issue when changing my screen orientation. I have an activity with
I'm trying to fix the issue with restarting activity on orientation changes. I have
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
We are new to ROR, We have issue in creating Login/Logout process in ROR
Share your ideas please! I have issue to check the folder and convert a
Have an issue with jquery autocomplete, focus function After i type something in the
I have an issue with a Lab for class and the issue is I'm

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.