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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:39:44+00:00 2026-06-15T23:39:44+00:00

I have overridden my UINavigationController to implement these methods: -(BOOL)shouldAutorotate { return [[self.viewControllers lastObject]

  • 0

I have overridden my UINavigationController to implement these methods:

-(BOOL)shouldAutorotate
{
    return [[self.viewControllers lastObject] shouldAutorotate];
}
-(NSUInteger)supportedInterfaceOrientations
{
    return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}

Now from my first view, I modally present this MSNavigationPaneViewController here which is like a Facebook side sliding tab bar controller.

I need 1 of my view controllers that are displayed within here to be displayed Landscape only while the rest of the app’s views are Portrait only.

So in all my other View Controllers I have added:

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}
- (BOOL)shouldAutorotate
{
    return UIInterfaceOrientationMaskPortrait;
}

and in the one that I want Landscape i’ve added:

- (BOOL)shouldAutorotate
{
    return UIInterfaceOrientationMaskLandscape;
}
-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

However all my views rotate.

If I change shouldRotate to NO on these other views then they stay in Portrait and the view I want to be Landscape can be rotated, however I can’t get it to rotate itself.
Also, once rotated if I go back to another view that has shouldRotate = NO; then it can’t be rotated back to Portrait.

I’ve been at this for hours now and can’t get it to work.

Thanks

EDIT —–

I have this half working now and have started a new question to get the auto rotation working here

  • 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-15T23:39:45+00:00Added an answer on June 15, 2026 at 11:39 pm

    It seems you are confusing what to return in shouldAutorotate. Use the following code as an example.

    Since iOS is making a call into your app’s shouldAutorotate in response to an event from the accelerometer, it already knows the new orientation; if your app answers ‘YES`, iOS could then check the current orientation against the list of supported ones, and come up with a decision without your app querying for the current orientation.

    // iOS 6

    - (BOOL)shouldAutorotate {
        return YES;
    }
    
    - (NSUInteger)supportedInterfaceOrientations {
        return UIInterfaceOrientationMaskPortrait;
    }
    

    Also, You can let the view controller that presents your modal view controller inform it of rotation. Use: presentViewController:animated:completion: to present the view controller. presentModalViewController:animated: is deprecated if by chance you are using it.

    If you add application:supportedInterfaceOrientationsForWindow:, make sure to follow the code guideline below. The documentation states that if you implement supportedInterfaceOrientations on a VC it should override the app delegate. However, people have noticed it makes a difference as to how you add the rootViewController to the main window.

    Use:

    window.rootViewController = viewController
    

    instead of:

    [window addSubview:viewController.view];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following problem: I have overridden popViewControllerAnimated:(BOOL)animated of UINavigationController because I would
I have a TabbarController with different ViewControllers. Some of these ViewControllers should autorotate and
I have overridden my back button method and I want to know, when at
I have overridden the SimpleHandler to pass a username and password using soap4r. the
I have overridden equals() and hashCode() in my ClassA. ClassA { //overridden equals() and
I have a problem with django model objects where I have overridden __hash__ ()
I am writing a WPF application on WinXP and I have overridden the default
I am currently working on a Magento extension, and I have overridden a core
I am using ASP.NET 2.0 and its various providers. I have overridden most of
I have a overridden UIGestureRecogniser designed to detect 2 touches, but not necessarily one

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.