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

The Archive Base Latest Questions

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

I have created a simple application which has a red background and a button

  • 0

I have created a simple application which has a red background and a button on it (for the purposes of understanding this problem). The app is in landscape mode and being built with iOS6 framework.

I have set the Supported interface orientations pList properties to only have: Landscape (right home button)

If I put the methods -(BOOL)shouldAutorotate and -(NSUInteger)supportedInterfaceOrientations in the view controller and initiate it as the windows rootViewController WITHOUT using a UINavigationController then landscape orientation is achieved.

HOWEVER if I use a subclassed UINavigationController like in the example below and implement -(BOOL)shouldAutorotate and -(NSUInteger)supportedInterfaceOrientations , landscape orientation is NOT achieved and -(BOOL)shouldAutorotate is never called.

I have the following code in my Subclassed UINavigationController:

 //For iOS 5.x and below
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
 {
  return (interfaceOrientation != UIInterfaceOrientationLandscapeRight);
 }

//For iOS 6.0
-(NSUInteger)supportedInterfaceOrientations
{
 return UIInterfaceOrientationMaskLandscapeRight;
}

-(BOOL)shouldAutorotate
{
return YES;
}

In my appDelegate I have these methods:

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{



self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];

viewController = [[MDViewController alloc] init]; //a very simple viewcontroller containing button on red background which should be in landscape mode
navigationController = [[MDNavigationController alloc] initWithRootViewController:viewController];
[self.window setRootViewController:navigationController.topViewController];

[self.window makeKeyAndVisible];
return YES;
}

-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:  (UIWindow *)window {
   return UIInterfaceOrientationMaskLandscapeRight;
 }

I have seen countless answers to similar questions which I implemented but found that they fail to work.
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-13T12:08:41+00:00Added an answer on June 13, 2026 at 12:08 pm

    Shouldn’t you be doing this:

    [self.window setRootViewController:navigationController];

    instead of:

    [self.window setRootViewController:navigationController.topViewController];

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

Sidebar

Related Questions

I have created a simple win 32 application..in which it has a textbox and
I have created a simple Java application which has a JFrame and few JButtons.
I have created a simple application which has a scroll bar. The scroll bar
I created a simple ASP.NET MVC version 1.0 application. I have a ProductController which
I have a very simple problem. I have an application which is written in
I have a simple web application in which I have created a wizard, each
I have a fairly simple Django application (v1.3 on Red Hat) for which I'm
Ok. Here is some background: I have created a simple APEX application that is
I have created a very simple ASP.NET application with a web.config file, which contains
I have created a simple blog application with Ruby on Rails. The applications consists

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.