2012-05-07 55 views
0

有一个的UITabBarController如何更改UITabbarViewController的navigationBar的颜色?

- (void)getToMCGatherViewController 
{ 
    mCGatherViewController = [[MCGatherViewController alloc] initWithNibName:@"MCGatherViewController" bundle:nil]; 
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:mCGatherViewController]; 
    navigationController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 
    [self presentModalViewController:navigationController animated:YES]; 
    [navigationController release]; 
} 

在.h文件:

@interface MCGatherViewController : UITabBarController 

在.m文件。我想改变视图的导航条的颜色条形码

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    self.navigationController.navigationBar.tintColor=[UIColor greenColor]; 
} 

它根本不起作用。

帮我解决这个问题,提前谢谢!

+0

你的问题很复杂,请澄清你想要什么? – vishiphone

回答

2

刚过

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:mCGatherViewController]; 
在getToMCGatherViewController方法

添加

[navigationController.navigationBar setTintColor:[UIColor greenColor]]; 

+0

Thx男人,你的答案真的很有帮助!谢谢 ! – jxdwinter

+0

接受答案,如果它为你工作..快乐编码:) –

0

只需编辑您的代码,并尝试我认为这将适用于您。

mCGatherViewController = [[MCGatherViewController alloc] initWithNibName:@"MCGatherViewController" bundle:nil]; 
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:mCGatherViewController]; 
navigationController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 

[self.view addSubview:nav.view]; 

然后你改变你的导航栏的色调颜色。