【发布时间】:2013-07-26 07:57:14
【问题描述】:
我正在使用自定义导航栏。
在我的AppDelegate 中,我已经做到了。
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navbar"] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setTitleTextAttributes: @{
UITextAttributeTextColor: [UIColor whiteColor],
UITextAttributeTextShadowColor: [UIColor whiteColor],
UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0.0f, 1.0f)],
UITextAttributeFont: [UIFont fontWithName:@"Carrois Gothic" size:18.0f]
}];
在viewController 级别,我将按钮放在navigationController 内。在所有viewControllers 中,navigationbar 中只有一个按钮。
但是在一个 VC 中我需要设置 2 个按钮,并且我还更改了 navigationbar 的 backgroundImage。所以我在ViewDidLoad 中复制了与上面相同的代码,但现在使用了其他图像。这是有效的。
但现在我想在所有其他 VC 中使用第一个 navigationbar。所以在我的viewDidDisappear 中,我再次复制了另一张图片的代码。
以下是错误的:
- 背景图片没有变化
- leftbarbutton 不会消失
有人可以帮我吗?
PS:我正在使用tabbarcontroller。因此,如果我说切换 VC,我的意思是转到 tabbarcontroller 中的另一个选项卡
【问题讨论】:
标签: ios objective-c uinavigationcontroller uitabbarcontroller uinavigationbar