Search code examples
iphoneioscocoa-touchuiwindow

Rounded screen corners throughout the app with status bar


How can I achieve rounded corners on the screen while still displaying the status bar?

In the application delegate I am applying these settings to the window:

[self.window.layer setCornerRadius:10.0];
[self.window.layer setMasksToBounds:YES];
self.window.layer.opaque = NO;

but at the top of the screen I am not seeing the rounded corner because of the status bar. This is a problem because I need the status bar in the app too.

Can anyone suggest how I may fix this?


Solution

  • Do you want to remove the status bar? Or are you trying to round the corners of the status bar? If you are wanting to round the corners of the status bar, the quick and simple answer is that you cannot. If you want to remove the status bar, this is quick and easy:

    From Apple Class Reference:

    setStatusBarHidden:withAnimation:

    Hides or shows the status bar, optionally animating the transition. - (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation Parameters

    hidden YES to hide the status bar, NO to show the status bar.

    animation A constant that indicates whether there should be an animation and, if one is requested, whether it should fade the status bar in or out or whether it should slide the status bar in or out.