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

前端 未结 10 724
旧巷少年郎
旧巷少年郎 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:12

    EDIT: This solution is deprecated on iOS 9. Please choose one of the other answers.

    With UIViewControllerBasedStatusBarAppearance set to NO, I was able to set the style to white text by using:

    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackTranslucent;
    

    This is because the text color on this style was white on iOS 6 and below.

    UPDATE: According to @jowie you can try that on iOS8:

    [UIApplication sharedApplication].statusBarStyle = UIBarStyleBlack;
    

提交回复
热议问题