I am trying to setTintColor for a viewcontroller that inherits from a UITableViewController.
I tried to put
[self.navigationController.navigationBar setTintColor:[UIColor blackColor]];
as the last line in loadView, but the color doesn't change. Where should I make this change?
Here is the interface definition of the controller:
@interface MyViewController : UITableViewController
{
Model *model;
NSArray * calculators;
}
@end
开发者_开发问答
UPDATE: I finally put it in viewDidAppear and it worked.
Are you sure that your self.navigationController is not nil? This is a usual bug happenning all the time that you didn't present your MyViewController
with a navigationController
Try this
self.navigationController.navigationBar.tintColor = [UIColor blackColor];
I put my solution in the question.
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController.navigationBar setTintColor:[UIColor blackColor]];
}
精彩评论