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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:29:08+00:00 2026-05-27T10:29:08+00:00

My UIWindow initially has a white background. I want to change the background to

  • 0

My UIWindow initially has a white background. I want to change the background to blue (permanently) when the device rotates. But what actually happens is the color briefly flashes blue then goes back to white.

In the app delegate:

- (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation
{
    self.window.backgroundColor = [UIColor blueColor];
}

This code gets called as expected, but when the rotation finishes, -[UIWindow setBackgroundColor:] gets called a second time (as I discovered by subclassing UIWindow). The call stack for the second call is:

-[UIWindow setBackgroundColor]
-[UIWindow _finishedFullRotation:finished:context:]
-[UIViewAnimationState sendDelegateAnimationDidStop:finished:]
-[UIViewAnimationState animationDidStop:finished:]
-run_animation_callbacks
...

Edit (for @VinceBurn’s answer)

The application has exactly one view (from Xcode’s View-based Application project template). I have now set the view’s background color (in IB) to 0% opacity. Still getting the same results.

To make sure the white color is not coming from some other default color setting, I am now initially setting the window’s background color to green:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    // Override point for customization after application launch.

    // Add the view controller's view to the window and display.
    self.window.backgroundColor = [UIColor greenColor];
    [self.window addSubview:viewController.view];
    [self.window makeKeyAndVisible];

    return YES;
}

When it rotates, it briefly flashes blue but returns to green.

  • 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-27T10:29:08+00:00Added an answer on May 27, 2026 at 10:29 am

    What I ended up doing was to change the background color of the active UIViewController‘s view, instead of the UIWindow:

    - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
    {
        self.view.backgroundColor = [UIColor blueColor];
    }
    

    The reason I had been trying to set the background color of the UIWindow was to get the same background color throughout the app. Apparently the simplest way to accomplish that is to have all UIViewControllers in the app inherit from a UIViewController subclass that implements -didRotateFromInterfaceOrientation:.

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

Sidebar

Related Questions

I am trying to change the background color of a UIWindow when an action
I m using UIimageview on top of UIWindow. I want to handle touch event
The UIKit reference says UIView is a superclass of UIWindow, but despite of this
My application starts off with nothing but a UIWindow . I programmatically add a
So I have this UIWindow that has some custom properties. I also have a
My iPhone game's appDelegate has a UIWindow window member variable. I add UIImageViews to
I have a UIWindow with windowLevel set to UIWindowLevelStatusBar+1. This window has a single
I have a custom UIWindow class that has an IBOutlet @interface MyWindow IBOutlet UIView
Yes, I know subclassing UIWindow is frowned upon, but my subclassed UIWindow is for
I have an iphone application which is having a UIWindow. I want to add

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.