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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:06:33+00:00 2026-06-05T03:06:33+00:00

Background: I want to make sure my viewControllers rotate properly when it appears. My

  • 0

Background: I want to make sure my viewControllers rotate properly when it appears. My viewControllers have excellent codes managing the rotation and orientation when it is visible.

Problem: Given two viewControllers in a NavigationController, viewC1 and viewC2. I did the following:

1.) Set rootViewController to viewC1

2.) Push viewC2 into the NavigationController

3.) Rotate

4.) Pop viewC2

5.) viewC1 is still stucked in the old orientation look (as in the transformation code in willAnimateRotationToInterfaceOrientation was not called) with the new orientation.

What can I do to ensure viewC1 call willAnimateRotationToInterfaceOrientation to reconstruct itself to look correctly in the new rotation?

Additional info:
This is all code (no storyboard/xib). I have shouldAutorotateToInterfaceOrientation return YES on all the views. I use willAnimateRotationToInterfaceOrientation to manage all my rotation.

Oh, and please no hacks. For example, copy the code from rotation then check the rotation mannually and manage it in viewDidAppear.

  • 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-05T03:06:35+00:00Added an answer on June 5, 2026 at 3:06 am

    Think about the name of the method, and what you’re trying to achieve.

    willAnimateRotationToInterfaceOrientation indicates that the view controlled by the view controller is about to animate to a particular orientation. If your view is in the middle of a navigation stack, then it is not being displayed on screen. To animate something that isn’t on screen is costly and ultimately worthless. So, that particular method is out of the question, but the problem that remains is there isn’t anything else more appropriate in UIKit. The reason is to rotate something (even if not animated) when it’s offscreen is worthless cost. It’s the responsibility of the developer to handle a change in orientation when the view appears (“transformation on demand” as you will).

    You say you don’t want hacks, but the method you’ve described as a hack is probably the most appropriate thing to do. Having a generic method named something like
    -(void) updateLayoutForOrientation:(UIInterfaceOrientation)orientation animated:(BOOL)animated { ... }
    isn’t a bad idea. This can be the handler for orientation change transformations for the whole view controller.

    The places you need to possibly check/handle orientation issues are

    -(void) viewWillAppear:(BOOL)animated

    -(void) willAnimateRotationToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation duration: (NSTimeInterval) duration

    and in both of these, call updateLayoutForOrientation:animated: to do the work for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make a DIV background (which doesn't have a background color) flash
I want to make a background image disappear. It works. But it fails when
My question is I have a div and I want to make it invisible
I want to make sure the location received by the LocationListener is a real
Just want to make sure I'm not overlooking something obvious... It seems like it
I want to make sure a file path set via query string does not
Background I want to access the cache of Chrome and Firefox in my Cocoa
Background : I want to create a custom VB compiler, extending the original compiler,
Background We want to run an FTP server on a Red Hat Enterprise OS.
Background: I want to show the time and date uptill only 1 week. After

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.