iOS 7 and later: set status bar style per view controller

前端 未结 10 726
旧巷少年郎
旧巷少年郎 2020-12-02 07:43


I tried many ways to set the status bar style (default or lightcontent) but can\'t get it to work on a per view controller basis. I can set the status bar style for the

10条回答
  •  醉话见心
    2020-12-02 08:13

    On viewDidLoad method, put this:

    Objective C

    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    [self setNeedsStatusBarAppearanceUpdate];
    

    Swift

    UIApplication.shared.statusBarStyle = .lightContent
    self.setNeedsStatusBarAppearanceUpdate()
    

提交回复
热议问题