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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:31:09+00:00 2026-05-13T13:31:09+00:00

I have a navigation-based application in which I would like just one of the

  • 0

I have a navigation-based application in which I would like just one of the viewcontrollers to support landscape orientation. For that viewcontroller (vc1), in shouldAutorotate, I am returning YES for all orientations and in the other controllers I am returning YES only for portrait mode

But even then if the device is in landscape mode and I go to the next screen from vc1, the next screen also comes up rotated in landscape mode. I assumed that if I return a YES only for portrait mode, the screen should show up only in portrait.

Is this the expected behavior? How do I achieve what I am looking for?

Thanks.

  • 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-13T13:31:10+00:00Added an answer on May 13, 2026 at 1:31 pm

    You can’t support the landscape orientation only for one of the viewcontrollers if you use shouldAutorotateToInterfaceOrientation method of UIViewController.
    You have only two choice whether all viewcontrollers support the landscape or no viewcontrollers support it.

    If you want to support the landscape only for one, You need to detect device rotation and manually rotate views in the viewcontroller.
    You can detect the device rotation by using Notification.

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

    Then, you can rotate your views when you detect the device rotation.

    - (void)didRotate:(NSNotification *)notification {
        UIDeviceOrientation orientation = [[notification object] orientation];
    
        if (orientation == UIDeviceOrientationLandscapeLeft) {
            [xxxView setTransform:CGAffineTransformMakeRotation(M_PI / 2.0)];
        } else if (orientation == UIDeviceOrientationLandscapeRight) {
            [xxxView setTransform:CGAffineTransformMakeRotation(M_PI / -2.0)];
        } else if (orientation == UIDeviceOrientationPortraitUpsideDown) {
            [xxxView setTransform:CGAffineTransformMakeRotation(M_PI)];
        } else if (orientation == UIDeviceOrientationPortrait) {
            [xxxView setTransform:CGAffineTransformMakeRotation(0.0)];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UINavigationBar based application - only a one navigation bar that is
Hey. I have a Navigation-controller-based application with a number of Viewcontrollers in it which
I have a navigation based application which also needs to have a view always
I have a navigation based application which I'm trying to add a unique UIToolbar
I have tab based application which also have Navigation controllers, When the user in
I have a UITabBar in the detail view of my navigation based application. I
I have a navigation-based app and say my root controller A causes a viewController
I'm writing a Navigation-Based iPhone app, and I'd like to have a UIToolBar docked
I have a jQuery based accordion style navigation that I am trying to modify.
I have an iPhone app that is based on a navigation controller. I have

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.