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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:40:37+00:00 2026-06-13T21:40:37+00:00

My app supports two groups of viewControllers, those that are supposed to work in

  • 0

My app supports two groups of viewControllers, those that are supposed to work in portrait and those who are supposed to work in landscape.

Presenting viewControllers of different orientations from each other results in wrong orientations, so someone suggested me to create a viewController containment master viewController (making that shoulAutorotate YES to all orientations) and add two branches of viewControllers from that, one for portrait (with shouldAutorotate YES for portrait) and one for landscape (with shouldAutorotate YES for landscape). My question is: will this work? I mean, will each viewController on each branch rotate to the correct orientation?

Another question is this: my project is based on the single view Xcode template. That template creates a RootViewController as the one that shows when the app starts. My problem is this: to make the containment suggestion works I have to transform this rootViewController in the container viewController and I have to move all the code it has to another view controller and present that when the app starts. I mean this:

WHAT I HAVE TODAY

  • the app runs and shows the rootViewController. Lets call this vCA.

If I chabge the rootViewController to be the container viewController I will have this

  • the app runs and shows the containerController that is completely empty and has to present the old vCA.

It appears to me a dumb solution, I mean, present the containerController that is empty and will call vCA?

How do I do that?

thanks.

  • 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-13T21:40:39+00:00Added an answer on June 13, 2026 at 9:40 pm

    Your question is kind of confusing since you use the term present, as in a modal ViewController but you also mention containment which would create a different solution.

    It all depends on your app really. If one branch of ViewControllers is only portrait and the other only landscape then using containment is probably going to be difficult because of the moment you switch between the two. Orientation calls are passed from the parent to the children but they are only called when a rotation occurs. So for example, your phone is in portrait and you’re viewing the portrait VC, when you switch to the landscape VC it will appear in portrait, when you rotate the device the orientation calls will make it go landscape and prevent it from going back to portrait. The same goes the other way around.
    There is a trick to force the device to go through all orientation callbacks of each ViewController and thus force a rotation, but I’m not sure it works in every iOS version. You can remove the view of the rootViewController from its superview (the window) and immediately add it again which will trigger the orientation callbacks. So you could try to do that every time you switch between child ViewControllers.

    Or instead of using containment, you could use the portrait VC as your rootViewController, create the landscape ViewController and store it somewhere so it remains in memory. When you need to show the landscape ViewController you present it modally on the rootViewController. If your autorotation methods are set correctly, it will change the orientation of the status bar and show the VC in the correct orientation. When you dismiss it the orientation will return to portrait.

    Edited:

    I don’t have Xcode here but I typed up something quick in notepad. This should work, it’ll force the device to switch orientations, in this case without transition. If you want to use an animation, take a look at the modalTransitionStyle property of _landscapeVC.

    // In AppDelegate.h
    PortraitViewController* _portraitVC;
    LandscapeViewController* _landscapeVC;
    
    // In AppDelegate.m
    -(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
    {
        _portraitVC = [[PortraitViewController alloc] init];
        _landscapeVC = [[LandscapeViewController alloc] init];
    
        self.window.rootViewController = _portraitVC;
        [self.window makeKeyAndVisible];
    }
    
    -(void)showLandscape
    {
        [_portraitVC presentViewController:_landscapeVC animated:NO completion:^{}];
        [UIApplication sharedApplication].statusBarOrientation = _landscapeVC.interfaceOrientation;
    }
    
    -(void)showPortrait
    {
        [_landscapeVC dismissViewControllerAnimated:NO completion:^{}];
        [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationPortrait;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our app supports different browser version from IE to Firefox to Chrome. Now, some
I hope to create a single app that supports both the iPhone and the
Now that Google App Engine natively supports Django 1.0, I updated with the following
Google App Engine is a cloud computing architecture that supports java based web services
My app has to support landscape/portrait mode only for tablets, phones will only support
I have an app for iPhone on app store that supports all versions from
The rails codebase that I'm working on supports two web applications, and we use
I have an app that supports email subscriptions, surveys, and comment forms. I've got
I am building an app that needs to have support for two dimensional arrays
Update: Solved. See fix at bottom. In my iPad app which supports all orientations,

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.