UINavigationBar外观覆盖在iOS 5中 [英] UINavigationBar appearance override in iOS 5

查看:96
本文介绍了UINavigationBar外观覆盖在iOS 5中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navbarBackBlack.png"] forBarMetrics:UIBarMetricsDefault];
    [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navbarBackBlack.png"] forBarMetrics:UIBarMetricsLandscapePhone];
    [[UINavigationBar appearance] setTintColor:[UIColor colorWithWhite:0.72 alpha:1.0]];

但现在我想在我的应用程序中有一个地方,我想导航栏是一个不同的颜色比我在整个应用程序设置的通用颜色。如何仅对此特定设置更改此设置。是否可以?

But now I want to have one place in my app where I want the navbar to be a different color than this universal color I've set throughout the app. How can I change this for this particular settings only. Is it possible?

推荐答案

您也可以在导航栏的实例上调用setBackgroundImage。

You can call setBackgroundImage on the instance of the navigation bar as well.

查看相关文章:

自定义UITabBar背景图片在iOS 5中不起作用

它是否响应该选择器:

if ([navBar respondsToSelector:@selector(setBackgroundImage:)])
{
    [navBar setBackgroundImage:[UIImage imageNamed:@"tabbar_brn.jpg"]];
}
else
{
    // ios 4 code here
}

这篇关于UINavigationBar外观覆盖在iOS 5中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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