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

The Archive Base Latest Questions

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

THIS IS NOT A DUPLICATE QUESTION. A final working solution has NOT been provided

  • 0

THIS IS NOT A DUPLICATE QUESTION. A final working solution has NOT been provided yet so please do not close this question until we’ve accepted an answer or found and provided our own 100% working solution. Thanks!

==================================================================

Using Xcode 4.5.1, we have a tab-bar app with 5 tabs in it. Each tab contains a UINavigationController, so the entire App thus needs to be viewed in Portrait mode. There is one exception: an “image-gallery” type view controller that we need to open and be viewed full-screen, and in LANDSCAPE mode.

We were able to do this easily in iOS5 using the following code in that one particular ViewController:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
   return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

But shouldAutorotateToInterfaceOrientation has been deprecated in iOS6 and doesn’t work any more.

So, to get this to work in iOS6, we’ve taken the following steps so far:
1) created a subclass of the UITabBarController (which is our rootViewController)
2) set its supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation to UIInterfaceOrientationMaskPortrait (But note that we are NOT implementing the shouldAutorotate method in it)
3) Set the PROJECT/Target supported orientations to ALL

This ALMOST works perfectly: our “Image Gallery” ViewController does respond to both landscape modes – as it should – but it still initially opens in Portrait – which is bad. We need it to open up right in Landscape – and not ever be able to be displayed in Portrait. Right now it still doing both.

Any idea why its doing that – or how to fix it?

  • 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-13T18:08:27+00:00Added an answer on June 13, 2026 at 6:08 pm

    I had this exact same problem with an app I work on and this is how I solved it.

    First I created a subclass of UITabBarController called NonRotatingTabBarController with the portrait orientation code

    NonRotatingTabBarController.h

    #import <UIKit/UIKit.h>
    
    @interface NonRotatingTabBarController : UITabBarController
    @end
    

    NonRotatingTabBarController.m

    #import "NonRotatingTabBarController.h"
    
    @implementation NonRotatingTabBarController
    
    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
    {
        return UIInterfaceOrientationPortrait;
    }
    
    - (NSUInteger)supportedInterfaceOrientations
    {
        return UIInterfaceOrientationMaskPortrait;
    }
    
    @end
    

    Now when you create your Tab Bar Controller, it needs to be an instance of NonRotatingTabBarController

    self.tabBarController = [[NonRotatingTabBarController alloc] init]; // or whatever initialising code you have but make sure it's of type NonRotatingTabBarController
    

    Now in the ONLY view controller which needs to have landscape support, you need to override the rotation methods so it does rotate. In my case, it had to be fixed to landscape

    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
    {
        return (UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight);
    }
    
    - (NSUInteger)supportedInterfaceOrientations 
    {
        return UIInterfaceOrientationMaskLandscape;
    }
    

    In your project/target settings, you MUST have support enabled for all the interface orientations your app uses otherwise it will crash. Let the code above take care of rotation enabling/disabling.

    Xcode Project Settings

    Hope that helps!

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

Sidebar

Related Questions

This is NOT a duplicate question, and the problem is driving me crazy. I
Note, this is not a duplicate of .prop() vs .attr() ; that question refers
I hope this question is not a duplicate but I didn't find anything equivalent
Please do not flag this as a duplicate, I'm not asking about what is
Ok this is not duplicate of Alternative to Process.Start() because my question is something
Duplicate of this question . update - This is not an exact duplicate. See
This is not a duplicate of this question . I have to serialize the
I hope this is not a duplicate of a question, but I have three
This is not a duplicate question, i know how to create a rich editor,
Note this is not a duplicate of this similar but different question ! My

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.