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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:11:35+00:00 2026-05-27T18:11:35+00:00

I have a tab based application in which one tab is available in both

  • 0

I have a tab based application in which one tab is available in both portrait and landscape mode, all the others are only available in portrait.

I am checking against the button selected to allow rotation in shouldAutorotateToInterfaceOrientation: or not, but when I am in landscape mode, when I select a different tab I need to load that view controller but also force my application into the normal portrait layout mode.

There doesn’t seem to be a clear and preferred was to do this, I tried setting the status bar orientation but the status bar was the only visual element to move.

Any tips and examples would be great, 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-05-27T18:11:35+00:00Added an answer on May 27, 2026 at 6:11 pm

    I was able to do this, but I’m warning you now, it’s a hack.

    First, I created a category for UITabBarController called
    UITabBarController+SelectiveRotation:

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
        return [self.selectedViewController shouldAutorotateToInterfaceOrientation:toInterfaceOrientation];
    }
    

    This allows the TabBar to rotate freely whenever the selected tab allows an orientation. Make sure you import this file wherever you’re creating your UITabBarController (probably in your application delegate).

    Then, I had my AppDelegate make itself the delegate of the tab bar, and I implemented this method:

    - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
        // this ensures that the view that will be shown is presented in a supportred rotation
        UIViewController *c = [[UIViewController alloc]init];
        [viewController presentModalViewController:c animated:NO];
        [viewController dismissModalViewControllerAnimated:NO];
        [c release];
        if ([UIViewController respondsToSelector:@selector(attemptRotationToDeviceOrientation)]) {
            // this ensures that the view will be presented in the orientation of the device
            // This method is only supported on iOS 5.0.  iOS 4.3 users may get a little dizzy.
            [UIViewController attemptRotationToDeviceOrientation];
        }
    }
    

    This second bit of code forces the tab bar to rotate to an acceptable orientation when the tab changes. For instance, if you go to the tab that can rotate, and go to landscape, then go to a tab that only supports portrait, it’ll force the orientation change to portrait. On iOS 4.3 and earlier, going back to the rotated tab will present it in the orientation you left it in. I couldn’t figure out a way around that.

    I did all this because it was a client requirement, but I don’t think this is actually a very usable design. I don’t find too many visual tweaks to be disorienting, but forcing the device to rotate by this method is very jarring because it’s instantaneous. You might want to try it out and see how you feel about it.

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

Sidebar

Related Questions

I have written a tab based iPad application which has done well. I never
I have a tab-based application for windows, which I am developing by myself. I
I have tab based application which also have Navigation controllers, When the user in
I have a tab bar based application in which I am trying to add
I have an application which tab page based. To decrease the startup time I
I am doing an application which is of SingleView BASED Application,where i have many
I have this problem, I've got a navigation-based application, and on the one of
I have a tabbar application that has one screen that displays statistics based on
I have a tab bar controller (its a tab bar based application, so tab
I have a tab based application with a navigation controller in it. When i

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.