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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:52:26+00:00 2026-05-14T07:52:26+00:00

I’m strugging with getting an iPhone application which requires just about every push or

  • 0

I’m strugging with getting an iPhone application which requires just about every push or pop in the Nav Controller Stack to change orientation.

Basically the first view is portrait, the second landscape the third portrait again (Yes I know this is less than ideal, but that’s the design and I’ve got to implement it).

I’ve been through various advice on here….
How do I detect a rotation on the iPhone without the device autorotating?
Force portrait orientation on pushing new view to UINavigationViewController
Is there a documented way to set the iPhone orientation?
But without total success.

Setting to link against 3.1.2 my reading of the linked articles above seems to indicate that if my portrait view pushes a view with

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return ((interfaceOrientation == UIInterfaceOrientationLandscapeRight) );
}


Then then that view should appear rotated to landscape. What happens is it appears in its “broken” portrait form, then rotates correctly as the device is turned.

If I pop the controller back to my portrait view (which has an appropriate shouldAutoRotate…) then that remains in broken landscape view until the device is returned to portrait orientation.

I’ve also tried removing all the shouldautorotate messages, and instead forcing rotation by transforming the view. This kind of works, and I’ve figured out that by moving the status bar (which is actually hidden in my application) [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight; the keyboard will appear with the correct orientation when desired.

The problem with this approach is that the status bar transform is weird and ugly when you don’t have a status bar – a shadow looms over the page with each change.

So. What am I missing.

1) Am I wrong in thinking that in 3.1.2 (or possibly earlier) shouldAutorotateToInterfaceOrientation should provide the desired orientation simply by pushing controllers ?

2) Is there another way of getting keyboards to appear in the correct orientation.

3) Are the undocumented API calls the way to go (please no!)

  • 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-14T07:52:26+00:00Added an answer on May 14, 2026 at 7:52 am

    You shouldn’t use [UIViewController shouldAutorotateToInterfaceOrientation:] to trigger an orientation change; it’s only there to let the system know if automatic rotations are allowed. You should still update it to specify the orientation that’s allowed though.

    If you want to change the orientation when a particular view is showing, you should call [UIApplication setStatusBarOrientation:animated:] inside your [UIViewController viewWillAppear:] override method for each of the view controllers that force a particular orientation. That will cause a change when a view is being pushed onto the stack and when it’s being popped off it. Make sure you call super in your override method.

    This is also the right place to change how the status bar is displayed, if that’s something you’re doing.

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

Sidebar

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.