Wednesday 6 August 2014

How to change the background color of Status Bar in iOS 7

While handling the background color of status bar in iOS 7, there are 2 cases

Case 1: View with Navigation Bar


  In this case use the following code in your viewDidLoad method


  UIView *statusBarView = [[UIView alloc] initWithFrame:CGRectMake(0, -20, 320, 22)];

  statusBarView.backgroundColor = [UIColor yellowColor];
  [self.navigationController.navigationBar addSubview:statusBarView];

Case 2: View without Navigation Bar


 In this case use the following code in your viewDidLoad method


 UIView *statusBarView =  [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 22)];

 statusBarView.backgroundColor  =  [UIColor yellowColor];
 [self.view addSubview:statusBarView];
    

No comments:

Post a Comment