更改状态栏样式ios 7? [英] Changing status bar style ios 7?

查看:128
本文介绍了更改状态栏样式ios 7?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更改其中一个viewcontrollers的状态栏样式。我把这个

I am trying to change the status bar style of one of my viewcontrollers. I have put this


  1. 在plist中将基于视图的状态栏设置为YES

2.

 -(UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent;
}




  1. 同时添加




[self setNeedsStatusBarAppearanceUpdate]

[self setNeedsStatusBarAppearanceUpdate]

它可以工作,即我可以看到字体颜色为白色,但只是在一段时间后它变回其先前的类型..

It works i.e I can see the font color white but just after some time it changes back to its previous type..

推荐答案

如果您在运行期间遇到状态栏更改颜色

If you are experiencing status bar changing color itself during runtime

尝试将 UIViewControllerBasedStatusBarAppearance 设置为在plist中。

try setting set the UIViewControllerBasedStatusBarAppearance to NO in the plist.

在你的viewController中..设置里面的外观调用

And inside your viewController.. set the appearance call inside

-(void)viewDidLayoutSubviews
{
    if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
        [self setNeedsStatusBarAppearanceUpdate];
    }
}

这篇关于更改状态栏样式ios 7?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆