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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:04:36+00:00 2026-06-08T02:04:36+00:00

I have secondViewController that can display content in both landscape and portrait view. The

  • 0

I have secondViewController that can display content in both landscape and portrait view. The MainViewController (parent of secondViewController) can only display content in landscape mode.

When SecondView is in portrait mode and is pop out, the view the MainViewController (which is supposed to display content in landscape mode only) displays content in portrait. It does not refresh to landscape mode.

Is there a way to force MainViewController to refresh the content?

On the MainViewController’s viewWillAppear method, I have added setNeedsDisplay and layoutSubviews, etc.

-(void) viewWillAppear:(BOOL)animated {
    [self.view setNeedsDisplay];
    [self.view layoutIfNeeded];
    [self.view layoutSubviews];
}

but it is not reloading the view. I also tried the navigation controller’s delegate method – willShowViewController but its not working.

  • 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-08T02:04:37+00:00Added an answer on June 8, 2026 at 2:04 am

    Looks like if you remove the view and add it back it works

    UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
    if (UIDeviceOrientationIsPortrait(orientation)){        
        NSLog(@"force to landscape mode ");
        UIWindow *window = [[UIApplication sharedApplication] keyWindow];
        UIView *view = [window.subviews objectAtIndex:0];
        [view removeFromSuperview];
        [window addSubview:view];        
    }
    

    You can also use CGAffineTransformMakeRotation but it the rotation does not work on the navigation controller

        if (orientation == UIDeviceOrientationPortraitUpsideDown) {
            [self.view setTransform:CGAffineTransformMakeRotation(M_PI/-2.0)];
            //[self.navigationController.view setTransform:CGAffineTransformMakeRotation(M_PI/-2.0)];
        } else if (orientation == UIDeviceOrientationPortrait) {
            [self.view setTransform:CGAffineTransformMakeRotation(M_PI/2.0)];
            //[self.navigationController.view setTransform:CGAffineTransformMakeRotation(M_PI/-2.0)];
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a viewcontroller and its view that support only landscape in iPad. -
I have two view controllers name RootViewController and SecondViewController. In the FirstViewController I have
So i have two view controller in FirstViewController and SecondViewController in FirstViewController NSMutableArray *array;
Have deployed numerous report parts which reference the same view however one of them
Have 2 tables in Access 2007, both lists of certain tasks to be accomplished.
I have 2 view controllers. In the first I select a categorie in a
When this action gets executed it displays secondviewcontroller directly what i want is that
I have searched a lot about this topic and I can't get this code
i have a class RequestHandler that takes the requests for some ViewController and fetches
basically i have parsed some data from XML into a NSMutableArray that is shared

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.