Search code examples
iosscreen-rotation

Change color behind app on rotation


When an iOS app rotates it will reveal a black background when the app is between portrait and landscape. Is it possible to change this color from the default black to white? Changing the UIWindow's background color will not help. Here is an example of the black background in Safari during rotation: Safari rotation


Solution

  • I have done something similar but I couldn't find the source now, but here is the idea:

    Create and add a significantly larger view as backing view and center it.

    Add the UIWebView as subview of this large view whose background is white.

    Re-position the center of the UIWebView, too.