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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:56:12+00:00 2026-05-25T09:56:12+00:00

My app has navigation bar, where 1st screen returns YES to orientation, the second

  • 0

My app has navigation bar, where 1st screen returns YES to orientation, the second one is set to some orientation basing on what user choose in 1st screen. After going back to 1st screen from 2nd one, if user had device in hand in portrait but interface was in landscape, 1st screen is set to landscape. This happens because of

(BOOL)shouldAutorotateToInterfaceOrientation(UIInterfaceOrientation)interfaceOrientation 

Is called only after changing device orientation.

I want to check what is device orientation atm and set interface orientation to this one.
Tried:

//1st method:
UIViewController *rotateTheScreen = [[UIViewController alloc]init];
[self presentModalViewController:rotateTheScreen animated:NO];
[self dismissModalViewControllerAnimated:NO];
[rotateTheScreen release];

//2nd method:
UIInterfaceOrientation interfaceOrientation = self.interfaceOrientation;

//3rd method:
UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];

1st is acting strange, rotates all cases besides coming back from interface orientation = landscape and device orientation = landscape (here is a bug, he rotates to landscape)
2nd checks interface, like the name tells, and tho doesnt work for my problem
3rd as far as i heard is private and Apple rejects apps using this.

  • 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-25T09:56:12+00:00Added an answer on May 25, 2026 at 9:56 am

    Take a look at this thread.
    Basically, there’s no way to force a device orientation and get your application approved by Apple.

    Shortly, the method exists but is an undocumented method of the UIDevice class.

    [[UIDevice currentDevice] setOrientation: UIInterfaceOrientationLandscapeRight animated:YES];
    

    This gives a compiler warning that you can get rid of with a category.

    @interface UIDevice (MyAwesomeMethodsThatAppleWillNeverAllowMeToUse)
        -(void)setOrientation:(UIInterfaceOrientation)orientation animated:(BOOL)animated;
        -(void)setOrientation:(UIInterfaceOrientation)orientation;
    @end
    

    Also, some say that you can call these methods indirectly using performSelector to get around Apple’s static code analysis, as you can read in the comments here.

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

Sidebar

Related Questions

I have an app, which has a top navigation bar and a bottom tab
The app has an Action Bar, the action bar has several navigation tabs on
I have a navigation app that has many screens the user navigates to. A
I am creating a reference app which has a navigation bar at the top
My app has a main screen that the user always starts at, and from
I have a tab bar driven app. The app has some view controllers that
My iPhone app has a tab bar controller, and one of the tabs is
My app has a custom background for the navigation bar. So i made a
My app has several buttons which trigger different events. The user should NOT be
My app has a session timeout after 30 minutes. If the user has a

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.