How to change status bar style during launch on iOS 7

前端 未结 6 1374
慢半拍i
慢半拍i 2020-12-23 13:13

When I launch my app, it shows the launch image and a black status bar. How can I change it so the status bar is light during launch? I have set the status bar appearance to

6条回答
  •  醉话见心
    2020-12-23 14:18

    **
    
     - You must take care of these three things:
    
    **
    
    **- In info.plist file**
    Set UIViewControllerBasedStatusBarAppearance to YES
    
    **- In your view controller** in which you want change color of status bar
    add this [self setNeedsStatusBarAppearanceUpdate] in viewDidLoad
    
    **- Lastly, add this method**
    - (UIStatusBarStyle)preferredStatusBarStyle
    {
          return UIStatusBarStyleLightContent;
    }
    
    Note: If you want to set color of statusBar for all the View Controllers then steps are
    **- In info.plist file**
    Set UIViewControllerBasedStatusBarAppearance to YES
    
    **- Then add this in appDelegate**
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent; // **It is deprecated in iOS 9**
    

提交回复
热议问题