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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:02:50+00:00 2026-05-19T15:02:50+00:00

If a view is added to the window, orientation is set as portrait even

  • 0

If a view is added to the window, orientation is set as portrait even if the device is in landscape.
If the view is added in the app delegate, application:didFinishLaunchingWithOptions: method, then it works correctly. But if the view is added later it does not.

As an example, I have a routine to switch views. Simplest form is:

- (void)switchToNewViewController:(UIViewController *)newViewController { 
 if ([[window subviews]count]!=0) {
  [[[window subviews]objectAtIndex:0] removeFromSuperview];
 }
 [window addSubview:newViewController.view];
}

IF this is called from within didFinishLaunching, orientation is correct. If it is not, orientation is portrait.

Simplest case is within didFinishLaunching I have the following two lines

// The following line works
[self switchToNewViewController:fullScreenViewController];

// The following line which delays the method call until later results
// in incorrect orientation 
[self performSelector:@selector(switchToNewViewController:) withObject:fullScreenViewController afterDelay:0.1];

Is there a way to make the view have the proper orientation?

  • 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-19T15:02:50+00:00Added an answer on May 19, 2026 at 3:02 pm

    Make sure your shouldAutorotateToInterfaceOrientation in the view controllers has the right logic

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
    {
        return YES; //this supports all orientations
    }
    

    If you are linking stuff in InterfaceBuilder also make sure both the view and the viewcontroller are configured to the initial orientation you like. (There is a little arrow in the top right corner to rotate views and view controllers)

    If you still have problems, are you using a UINavigationController or similar? UINavigationController needs to be subclassed and shouldAutorotateToInterfaceOrientation implemented if you want to support something other than portait.

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

Sidebar

Related Questions

I have just added a Core Plot view to my application based on a
Hi i have a strange issue after adding my UIViewController.view to my Application Window.
Am trying to connect the App Delegate to the View Controller in Xcode4, but
I am working with iPhone app(LandscapeRight Mode), I have added a Image view named
Background: App has a shake to go home feature. Home view Only supports portrait.
My app is structured like this: - Window - Navigation controller - Table view
I have added a UILabel to my view programmatically like this: myLabel = [[UILabel
I have added the COleDropTarget variable to my view class and registered it in
I have a View where some input text to be added dynamica using jquery,
If I have added/removed/modified a large number of files in my local ClearCase view,

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.