Change the status bar background color color past iOS 7

前端 未结 8 1310
既然无缘
既然无缘 2020-12-30 04:02

I want to change background color of status bar on iOS 7, and I\'m using this code:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOp         


        
8条回答
  •  时光取名叫无心
    2020-12-30 04:34

    for what @Teja Kumar Bethina provided is helpful, but it's better to get the height of the statusBar from UIApplication singleton like below:

    UIApplication *app = [UIApplication sharedApplication];
    
    UIView *statusBarView = [[UIView alloc] initWithFrame:CGRectMake(0, -app.statusBarFrame.size.height, self.view.bounds.size.width, app.statusBarFrame.size.height)];
        statusBarView.backgroundColor = [UIColor blackColor];
    

提交回复
热议问题