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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:58:05+00:00 2026-06-12T11:58:05+00:00

I have a question about iOS 6 Orientation.Here is my file https://www.dropbox.com/s/f8q9tghdutge2nu/Orientations_iOS6.zip In this

  • 0

I have a question about iOS 6 Orientation.Here is my file
https://www.dropbox.com/s/f8q9tghdutge2nu/Orientations_iOS6.zip

In this sample code,I want to make the MasterViewController only has a Portrait Orientation and the DetailViewController has a Portrait Orientation,Landscape Orientation.

I know iOS 6 Orientation is controlled by top-most controller.

So I custom a UINavigationController(CustomNavigationController), set supportedInterfaceOrientations and shouldAutorotate in that class.

-(NSUInteger)supportedInterfaceOrientations{
    if([[self topViewController] isKindOfClass:[DetailViewController class]]){
        return UIInterfaceOrientationMaskAllButUpsideDown;
    }else{
        return UIInterfaceOrientationMaskPortrait;
    }
}

-(BOOL)shouldAutorotate
{
    return YES;
}

Everything is fine except when DetailViewController at Landscape Orientation press back button,MasterViewController will show the Landscape Orientation.

Can I let MasterViewController always show Portrait Orientation and DetailViewController can has many orientation?

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-06-12T11:58:06+00:00Added an answer on June 12, 2026 at 11:58 am

    I made this work as you suggested in your comment on the question. The problem is that the default UINavigatonController does not use the value of the top view controller, so you need to override it by creating a base class and setting it in the Storyboard as the base class.

    Below is the code that I use.

    - (NSUInteger) supportedInterfaceOrientations {
        return [self.topViewController supportedInterfaceOrientations];
    }
    

    I also have a base class for the rest of my View Controllers to default the behavior to use the Portrait orientation. I can override these methods for iOS 5 and 6 in any view controllers which support more than Portrait orientation.

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
    
    - (NSUInteger)supportedInterfaceOrientations {
        return UIInterfaceOrientationMaskPortrait;
    }
    
    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
        return UIInterfaceOrientationPortrait;
    }
    
    - (BOOL)shouldAutorotate {
        return FALSE;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read this question about the differences in the window- and view-based iOS
I have a quick question about ARC in iOS. (Sorry I've asked so many
I have a newbie question about integrating two iOS apps. I have created an
I have a question about this formula from a book: EFW (cm,kg)= 10^(-1,7492+(0,166*BPD)+(0,046*AC)-(2,646*AC*BPD/1000)) The
I have a question about presenting the TWTweetComposerViewController as a modal view in iOS
I have a question about the Required device capabilities item in the info.plist file.
this is my first question :) I have one pile file, and I have
This may be the silliest question i have ever asked here, but i just
This question is about iOS device rotation and multiple controlled views in a UINavigationController.
I have a question about a view sliding up. The example would be iOS's

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.