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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:18:36+00:00 2026-05-26T21:18:36+00:00

I need a view that can display both in Portrait and landscape.But when I

  • 0

I need a view that can display both in Portrait and landscape.But when I load another view I only want it show in landscape.

I have a view controller A.which can be shown in portrait and landscape.This view controller is create by the App delegate.

When I click a button on the view A.I create a view controller B which I want to display only in landscape.and load the view like [A.view addSubView:B.view].

When I rotate the device the function shouldAutorotateToInterfaceOrientation is called only in
controller A. No matter how I set the function in controller B.It can’t be called.

  • 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-26T21:18:37+00:00Added an answer on May 26, 2026 at 9:18 pm

    On your first view, make sure that

    -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
        return Yes;
    }
    

    And in your second view set it to

    -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
        return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
    }
    

    Update:
    Ok, try this…
    In your main view controller/app delegate, where the shouldAutorotateToInterfaceOrientation is run every time the device rotates, put a global level variable. something like

    .h
    @interface NavAppDelegate : NSObject <UIApplicationDelegate> {
        Bool *isMain;
    }
    
    .m
    -(void)viewDidLoad {
        isMain = Yes;
    }
    -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
        if (isMain) {
            return Yes;
        } else {
            return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
        }
    }
    // This bit is where you'll have to adapt it to how you change your views
    // but it's a basic idea.
    -(void)bitThatDoesTheViewChange:(viewController *) controller {
       isMain = No;
    
       *viewController = controller;
    
       [viewController release];
    
       isMain = Yes;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a lotus view that stores a number. I need to perform some
I know that's bad design, but I need access to the view from my
I have a table view with cells that can be deleted. When a cell
I'm working on a grid view that will display cells that will have some
I have two images that need to be overlaid over one another, and they
I need to create a View that represents an x/y axis. I will read
My view is that unless you need to change the basic structure of the
I need to implement a table view such that it has 3 different sections
I understand that we need to create MXML file to define a view. Suppose
I need to setup an ASP.Net MVC view with a Date Picker that will

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.