Technical Q&A QA1723

Views incorrectly draw underneath the status bar

Q:  Why does my view controller draw under the status bar?

A: If your view controller is the primary content to your UIWindow, this can occur when either not setting UIWindow's rootViewController property, or the view controller's "Layout" setting "Resize view From NIB" is NOT checked in Interface Builder.

Figure 1  Example of a view placed under the status bar.

Listing 1  Setting UIWindow's rootViewController property

if ([self.window respondsToSelector:@selector(setRootViewController:)])
        self.window.rootViewController = viewController;


Document Revision History


DateNotes
2012-02-07

New document that describes the conditions that can cause views to draw underneath the status bar.