This is really weird and I can't seem to be able to explain that. Took me hours to realize that only when I add a UIImageView as a subView to my self.view in the ViewController viewDidLoad then I can set the tint color of my navbar. If I add the UIImageView in the init method - tint color doesnt do anything to my nav bar.
So...
In this case my nav bar is getting the tint color:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
//NAV BAR COLOR
self.navigationController.navigationBar.tintColor = [UIColor blueColor];
//ADDING BACKGROUND IMAGE
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
imgView.image = [UIImage imageNamed:@"aaa.png"];
[self.view addSubview: imgView];
[self.view sendSubviewToBack:imgView];
}
Here it doesnt (just moved the adding of the image to the init method):
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
//ADDING BACKGROUND IMAGE
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
imgView.image = [UIImage imageNamed:@"aaa.png"];
[self.view addSubview: imgView];
[self.view sendSubviewToBack:imgView]; }
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
//NAV BAR COLOR
self.navigationController.navigationBar.tintColor = [UIColor blueColor];
}
This is how I call this view:
Login *loginViewController = [[Login alloc] initWithNibName:nil bundle:nil];
UINavigationController *navCntrl1 = [[UINavigationController alloc] initWithRootViewController:loginViewController];
[self presentModalViewController:navCntrl1 animated:YES];
Any idea why? I am soo puzzled...thanks!!