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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:26:56+00:00 2026-05-20T14:26:56+00:00

I’m new to StackOverflow, and also new to objective-c. I have tried looking for

  • 0

I’m new to StackOverflow, and also new to objective-c.

I have tried looking for a couple weeks now to find something that gives me a hint of what to do, but I can’t seem to get through this one without asking a question. It feels like it should be simple, but…

I’m having a problem with the rotation of a “rootView” controller. It should show up in landscape (which it did, before I decided to use a navigation controller). The simulator shows up in the correct orientation, but it has loaded the view rotated 90 degress left, so that the text reads from bottom to top, sideways, so you have to cock your head left. The leftmost portion of the view is visible, but the remainder of the view runs off the top of the screen. It’s a large program (I’m finding that, in general, with objective-c, but enjoying it nonetheless…), but here’s the gist of what I think are the important code areas:

In the appDelegate, I create a window, my rootViewcontroller, and the navcontroller:

// .h file:
UIWindow *window;
wordHelper3ViewController *viewController;
UINavigationController *navigationController;

Then in the implementation:

//.m file
- (BOOL)application:(UIApplication *)applicationdidFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    // Hide status bar
    application.statusBarHidden = YES;
        // --- Add the view controller's view to the window and display.
    [window addSubview:viewController.view];
    [window addSubview:navigationController.view];
    [window makeKeyAndVisible];
    return YES;
}

Then I release all of these in the dealloc.

In my root view, I’m doing this:

// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    if (interfaceOrientation == UIInterfaceOrientationLandscapeRight){
        return YES;
    } else {
        return NO;
    }
}

I implemented the following, to see what was happening, and I’m getting the log message on startup immediately:

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
    if (fromInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || fromInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
        NSLog(@"didRotate...");
    }
}

Other than this, I don’t think I’m doing anything in my code that should affect the view(s). So now, on to InterfaceBuilder:

In the attributes inspector for both the rootView and the navigation controller, the orientation is set to landscape. For the rootView, under referencing outlets, the “view” is set to file’s owner. I also have an action attached to the view (touchUpInside) – I changed its class to UIButton, because I wanted to resignFirstResponder when the user clicks anywhere in the background.

For the navigationController, under Referencing outlets, it shows a connection from the navigationController to my appDelegate.

In the main window xib, the nav contoller shows up in the list, and the view controller shows up as a subview of it.

The viewcontroller also shows up on its own, in the main window’s list of objects.

The only thing that stands out to me, is that when I double click the window object, IT comes up visually in portrait mode.

Does anyone have any ideas?

  • 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-20T14:26:57+00:00Added an answer on May 20, 2026 at 2:26 pm

    I think your problem is that you are adding your navigation controller as a subview to the window and orientation notifications are only sent to the first subview in “window”.

    Try this instead.

    
    //.m file
    - (BOOL)application:(UIApplication *)applicationdidFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
        // Hide status bar
        application.statusBarHidden = YES;
            // --- Add the view controller's view to the window and display.
        [window addSubview:viewController.view];
        [viewController.view addSubview:navigationController.view];
        [window makeKeyAndVisible];
        return YES;
    }
    
    

    Its annoying, but I’ve resolved orientation problems by only every having one subview in “window” and then controlling everything through that one subview (in this case viewController)

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

Sidebar

Related Questions

No related questions found

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.