[iOS]黑色状态栏 圆角内容区

1.项目中引用QuartzCore.framework

2.在AppDelegate.m文件中引用QuartzCore.h库

#import <QuartzCore/QuartzCore.h>

3.在application: didFinishLaunchingWithOptions:方法的return YES语句前添加以下代码

UIApplication *app = [UIApplication sharedApplication];

[app setStatusBarStyle: UIStatusBarStyleBlackOpaque];

self.window.rootViewController.view.layer.cornerRadius = 5;

self.window.rootViewController.view.layer.masksToBounds = YES;

4. 整体代码如下:

#import "AppDelegate.h"

#import <QuartzCore/QuartzCore.h>



@implementation Corner_TestAppDelegate



@synthesize window=_window;

@synthesize viewController=_viewController;



- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{     

    self.window.rootViewController = self.viewController;

    [self.window makeKeyAndVisible];

    

    UIApplication *app = [UIApplication sharedApplication];

    [app setStatusBarStyle: UIStatusBarStyleBlackOpaque];

    self.window.rootViewController.view.layer.cornerRadius = 5;

    self.window.rootViewController.view.layer.masksToBounds = YES;

    
return YES; }

你可能感兴趣的:(ios)