Friday, 18 March 2011

iOS: Prettier auto-rotation

A simple Friday iOS coding tip for you:

When your app auto-rotates do you have an unsightly white frame appearing around the edges of your beautifully hand-crafted UI?

The default Xcode UIView-based project template creates a UIWindow with a white background. The white frame on rotation is the background of the UIWindow peeping out behind your UIView subview.

The simple fix to your UI woes: make the UIWindow background clear (either in the XIB file, or just before your call to [window makeKeyAndVisible].



jono said...

Code sample. I'm having this exact issue.

Ben said...

Mad props on this tip. My UI looks 10x better with the click of one button, thanks!
Jono, I just clicked on MainWindow.xib and under attributes chose "hidden". Worked like a charm