UIStatusBar changes style for no apparent reason

倾然丶 夕夏残阳落幕 提交于 2019-12-11 03:36:23

问题


I have an app in which I set the UIStatusBarStyle to UIStatusBarStyleLightContent and it works perfectly fine for a while. Then, as suddenly than unexpectedly, it changes to UIStatusBarStyleDefault for no apparent reason.

View controller-based status bar appearance property is set to NO.

Is there a specific place which I should set the UIStatusBarStyle in? Currently I set it in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions before anything else.

Thank you very much for any clues.


回答1:


You have to set .plist file like :

write each view-controller :

-(UIStatusBarStyle)preferredStatusBarStyle
{
  if [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
    return UIStatusBarStyleLightContent;// for black color 
  }else
  {
     return UIStatusBarStyleDefault;// set as default
  }
}

Hope it will help.

happy coding...



来源:https://stackoverflow.com/questions/19671359/uistatusbar-changes-style-for-no-apparent-reason

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!