UIApplication.sharedApplication().setStatusBarStyle() deprecated in iOS 9

前端 未结 9 660
野的像风
野的像风 2021-02-01 13:34

I have been using

UIApplication.sharedApplication().setStatusBarStyle()

In my appDelegate and it has worked fine, but since iOS 9, this method

9条回答
  •  闹比i
    闹比i (楼主)
    2021-02-01 14:17

    In info.plist, set: View controller-based status bar appearance boolean to NO

    In app delegate's didFinishLaunchingWithOptions, use function parameter application (and not the [UIApplication sharedApplication] or simillary the UIApplication.sharedApplication() in swift) to set this like so:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        application.statusBarStyle = UIStatusBarStyleLightContent;
    }
    

提交回复
热议问题