0

有一个 UITabBarController

- (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];
}

它根本不起作用。

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

4

2 回答 2

2

只需添加

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

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:mCGatherViewController];

在您的 getToMCGatherViewController 方法中。

于 2012-05-07T06:48:32.360 回答
0

只需像这样编辑您的代码并尝试我认为这对您有用。

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

[self.view addSubview:nav.view];

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

于 2012-05-07T06:57:19.920 回答