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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:18:09+00:00 2026-06-15T13:18:09+00:00

My application window’s root view controller is a subclassed UINavigationController. I have added this

  • 0

My application window’s root view controller is a subclassed UINavigationController. I have added this code to the class:

- (BOOL)shouldAutorotate
{
    return [self.topViewController shouldAutorotate];
}

- (NSUInteger)supportedInterfaceOrientations
{
    return [self.topViewController supportedInterfaceOrientations];
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return [self.topViewController preferredInterfaceOrientationForPresentation];
}

In my root UIViewController I have added this code:

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}

- (BOOL)shouldAutorotate
{
    return NO;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationPortrait;
}

When the device is rotated to landscape on this view controller, I present a modal view controller. When the device is rotated back to portrait, I am supposed to dismiss the modal view, but when I do I get the following error:

'preferredInterfaceOrientationForPresentation must return a supported interface orientation!'

Why am I getting this error?


I tried returning YES from shouldAutorotate in the root UIViewController, and now I get the error ‘Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES’. This makes no sense to my, because UIInterfaceOrientationPortrait is one of the applications supported orientations.

  • 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-15T13:18:10+00:00Added an answer on June 15, 2026 at 1:18 pm

    In -supportedInterfaceOrientations, you need to return values from UIInterfaceOrientationMask, not UIInterfaceOrientation. In particular, it looks like you want UIInterfaceOrientationMaskPortrait

    Here’s what the documentation for -supportedInterfaceOrientations says about the return value:

    Return Value

    A bit mask specifying which orientations are supported. See “UIInterfaceOrientationMask” for valid bit-mask values. The value returned by this method must not be 0.

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

Sidebar

Related Questions

I have come across this Cocoa application (source code) that shows a main Window.
Hi i have a strange issue after adding my UIViewController.view to my Application Window.
i have this at my appdelegate: for 1st app: - (void)applicationDidFinishLaunching:(UIApplication *)application { [window
I have two nib files: the main application window, and a small view that
I have the following code in the onModuleLoad() of my application: Window.addWindowClosingHandler(new ClosingHandler() {
I have a situation where I have to detect when an application window is
Desktop window application. I have textbox in which user give values in numbers. what
I have a window application which uses SP classes to create a site. I
I have developed a window application in VS2005 using C#. I need to integrate
I'm developing a window application in C# VS2005. I have a dataGridView in which

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.