【问题标题】:Status bar color not changing according navigation bar's color状态栏颜色不会根据导航栏的颜色而改变
【发布时间】:2013-10-03 21:12:54
【问题描述】:

我遇到了这个问题。我在 iOS6 和 iOS7 上都有一个项目。在整个应用程序中,我正在使用 UINavigationBars。但是我的应用程序的状态栏不会根据我的导航栏的背景图像改变他的颜色。我的导航栏自定义代码:

- (void)setBackgroundImageForNavigationBar:(UINavigationBar *)navBar {
    UIImage *backgroundImage = [UIImage imageNamed:@"navigationBackgroundImage"];
    backgroundImage = [backgroundImage resizableImageWithCapInsets:UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, 0.0f)];
    [navBar setBackgroundImage:backgroundImage forBarMetrics:UIBarMetricsDefault];
    [navBar setShadowImage:[[UIImage alloc] init]];
}

对于 iOS6,它工作正常。如何解决 iOS7 的这个问题?

【问题讨论】:

    标签: iphone objective-c ios6 ios7


    【解决方案1】:

    您的图片需要为 66 像素(或 @2x 版本 132)。如果是 44,你仍然会得到顶部的小条。

    【讨论】:

    • 不错的答案。它有助于。但我不明白为什么它适用于 iOS6 而不适用于 iOS7?
    • 我最近在 iOS 领域的一些项目上一直在问自己这个问题。我知道没有关于此的官方文档,但看到另一个用户帖子描述了这种情况。当我对我的应用进行更改时,效果很好。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多