【问题标题】:Toggle ios7 status bar [closed]切换 ios7 状态栏 [关闭]
【发布时间】:2013-09-25 01:05:21
【问题描述】:

我想知道是否有办法暂时隐藏 ios7 状态栏(即切换)。我已经在网上搜索了,我只能找到如何无限期地关闭它。

问题是我有一个子视图用作全屏,不幸的是,需要隐藏状态栏以使子视图看起来更干净。

这是我找到的隐藏状态栏的代码..但我不知道如何在隐藏后再次将其恢复。

- (BOOL)prefersStatusBarHidden
{
    return YES;
}

任何帮助将不胜感激。

【问题讨论】:

    标签: ios ios7 statusbar


    【解决方案1】:

    It is actually right in the description of the method in the documentation here

    如果更改此方法的返回值,请调用 setNeedsStatusBarAppearanceUpdate 方法。

    所以只要让你的prefersStatusBarHidden方法根据你是否想要隐藏它有条件地返回YES或NO,当你知道结果会改变时调用setsNeedsStatusBarAppearanceUpdate

    示例:

    - (BOOL)prefersStatusBarHidden
    {
        if(someViewIsVisible)
            return YES;
        else
            return NO;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-01
      • 2013-11-12
      • 2013-10-26
      • 1970-01-01
      • 1970-01-01
      • 2017-10-31
      • 1970-01-01
      相关资源
      最近更新 更多