Rounded corners of the screen throughout the application with a status bar

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

In the application delegate, I apply 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 don’t see a rounded corner due to the status bar. This is a problem because I also need the status bar in the application.

Can someone tell me how I can fix this?

+3
source share
4 answers

Do you want to delete the status bar? Or are you trying to get around the corners of the status bar? If you want to get around the corners of the status bar, the quick and easy answer is that you cannot. If you want to delete the status bar, this is quick and easy:

From the Apple Reference:

setStatusBarHidden: withAnimation:

, . - (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation Parameters

, , , .

, , , , .

0

- , .

, :

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

.

+1

viewWillAppear. Nfeel . "QuartzCore".

self.view.layer.cornerRadius = 10.0

, .

0

, ,

func applicationDidBecomeActive(_ application: UIApplication) {
    window?.layer.cornerRadius = 10
    window?.clipsToBounds = true
    window?.backgroundColor = UIColor.black
}

AppDelegate.swift, : D

0
source

All Articles