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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:40:51+00:00 2026-06-01T22:40:51+00:00

I’m confused about the implementation of autorotation in ios. I have a UIViewController, and

  • 0

I’m confused about the implementation of autorotation in ios.
I have a UIViewController, and I tell it to autorotate inside shouldAutoRotateToInterfaceOrientation. However, it doesn’t work.
So I read something about how I need to look at the navigation stack AND/OR whether a UITabBarController was used, because this has been known to cause all kinds of confusion (raises hand).

In fact, I have a UITabBar and a UINavigationController. The UIView that I want to rotate is being pushed onto the stack three or four ‘levels’ deep.

Why isn’t autorotation solely determined by whatever the shouldAutoRotateToInterfaceOrientation returns inside the current UIViewController?

From apple’s technical doc located at: https://developer.apple.com/library/ios/#qa/qa2010/qa1688.html about why a UIViewController may not be rotating when you expect it to:

All child view controllers in your UITabBarController or UINavigationController do not agree on a common orientation set.

To make sure that all your child view controllers rotate correctly,
you must implement shouldAutorotateToInterfaceOrientation for each
view controller representing each tab or navigation level. Each must
agree on the same orientation for that rotate to occur. That is, they
all should return YES for the same orientation positions.

Can someone summarize what facts we need to be aware of when working with UITabBars and UINavigationControllers? Where do people commonly mess up or what are points of muddiness?

If you have a UITabBar, UITabBarController, or UINavigationController, all of its child views need to have the same autorotation behavior. But surely you can have some child views rotate and others not rotate, right?

I suspect that common reasons for failing have to do with not understanding the responder chain well enough as it applies to autorotation. If so, can someone clear this up for me? Then I might be able to figure out ‘selective autorotation’.

To add to this, other posts indicate that you must subclass UITabBarController and override shouldAutorotateToInterfaceOrientation.

  • 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-01T22:40:53+00:00Added an answer on June 1, 2026 at 10:40 pm

    I think the reason you want them all to respond the same way is because it gets awkward for the user. If you are in landscape mode on your special view that can rotate, it will be a strange experience when you pop that viewcontroller to the parent on the navigationcontroller or tap a tab that does not have landscape mode.

    I think that is the reasoning there.

    However, you can catch the device orientation notifications and handle them yourself if you want and push in a new view if the device rotates on the particular view you want to rotate.

    Use this:

    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(rotationDetected) name:@"UIDeviceOrientationDidChangeNotification" object:nil];
    

    then create a function rotationDetected that handles what happens when we rotate…like this:

    -(void) rotationDetected {
    
        if (([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft) || ([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight)){
    
        //Push on the view in landscape orientation if we aren't there already
    
    } else if ([[UIDevice currentDevice] orientation] == UIDeviceOrientationPortrait || [[UIDevice currentDevice] orientation] == UIDeviceOrientationPortraitUpsideDown) {
    
        //If the landscape view is present, pop it back to the portait view  
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am reading a book about Javascript and jQuery and using one of the
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

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.