ios - preferredStatusBarStyle is not working -


this question has answer here:

i used use setstatusbarstyle in project , works fine, deprecated use preferredstatusbarstyle, didn't work. knowing i've:

  1. call method setneedsstatusbarappearanceupdate.
  2. set "view controller-based status bar appearance" no in info.plist
  3. override function

    • (uistatusbarstyle)preferredstatusbarstyle { return uistatusbarstylelightcontent; }

    this function not called

note: i'm using navigation controller.

if want set status bar style, application level set uiviewcontrollerbasedstatusbarappearance no in .plist file. , in appdelegate > didfinishlaunchingwithoptions add following ine.

[uiapplication sharedapplication] setstatusbarstyle:uistatusbarstylelightcontent animated:yes]; 

if wan set status bar style, @ view controller level follow these steps:

  1. set uiviewcontrollerbasedstatusbarappearance yes in .plist file, if need set status bar style @ uiviewcontroller level only.
  2. in viewdidload add function - setneedsstatusbarappearanceupdate

  3. override preferredstatusbarstyle in view controller.

-

- (void)viewdidload {     [super viewdidload];     [self setneedsstatusbarappearanceupdate]; }  - (uistatusbarstyle)preferredstatusbarstyle {     return uistatusbarstylelightcontent; } 

set value of .plist according status bar style setup level. enter image description here


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -