iOS导航。酒吧形象

时间:2014-03-07 21:52:23

标签: ios uinavigationitem appdelegate

iOS Nav。酒吧形象

我需要在导航中显示图像。栏,但只在应用程序的第一个屏幕上,然后其余都是空白。问题是,如果我将背景设置为一个图像,它会转移到所有其他屏幕。如何在主屏幕导航中使用它。吧,但是把它改成所有其他的空白?

2 个答案:

答案 0 :(得分:0)

您应该使用UIAppearance appearanceWhenContainedIn 方法来指定导致修改的类。

清除所有导航栏中的图像:

[[UINavigationBar appearance] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];

YourViewController

的导航栏中设置图片
[[UINavigationBar appearanceWhenContainedIn:[YourViewController class], nil] setBackgroundImage:[UIImage imageNamed:@"yourImage"] forBarMetrics:UIBarMetricsDefault];

答案 1 :(得分:0)

您可以在ViewController中设置titleView的{​​{1}},我应该在navigationItem上显示图片。

UINavigationBar
相关问题