Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOS7 navigatinBar tintColor change in popover

I developed iPad application. I'm opening some screens in popover with navigation controller. But I did not change navigationcontroller tint color in IOS 7. How can I change this color. thanx

enter image description here

UINavigationController *navigationController = [[[UINavigationController alloc] initWithRootViewController:airportsSearch] autorelease];
navigationController.navigationBar.barTintColor = [UIColor blackColor];
navigationController.navigationBar.translucent = NO;
self.popOver=[[UIPopoverController alloc] initWithContentViewController:navigationController];

self.popOver.delegate                    = self;
[self.popOver setPopoverContentSize:CGSizeMake(285, 370)];

[self.popOver presentPopoverFromRect:tempButton.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
like image 294
hiwordls Avatar asked Sep 30 '13 13:09

hiwordls


2 Answers

The magical word here is barStyle, you need to do the following if you need it black:

navigationController.navigationBar.barStyle = UIBarStyleBlack;
navigationController.navigationBar.translucent = NO;

And if you want to change its color:

navigationController.navigationBar.barTintColor = [UIColor redColor];
navigationController.navigationBar.barStyle = UIBarStyleBlack;
navigationController.navigationBar.translucent = NO;
like image 95
Tarek Hallak Avatar answered Oct 20 '22 01:10

Tarek Hallak


Setting the NavigationBarStyle to UIBarStyleBlack also worked for me, but only via the Storyboard.

I tried

[[UINavigationBar appearance] setBarStyle:UIBarStyleBlack];

as well as

[[UINavigationBar appearanceWhenContainedIn:[UIPopoverController class], nil] setBarStyle:UIBarStyleBlack];

in the didFinishLaunchingWithOptions AppDelegate method. But nothing changed. Only changing the BarStyle of the NavigationControllers NavigationBar inside the Storyboard worked.

like image 27
Blank Avatar answered Oct 20 '22 00:10

Blank