Why UINavigation blink black - ios

Here is the code:
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];

ah, I have solved that problem.
In my AppDelegate.m, when i initialized the UIWindow, i didn't set the UIWindow's backgroundColor or its rootViewController's backgroundColor. So setting one of the two backgroundColor will OK.
When the view who was pushed to the top doesn't well-initialized(In method of "viewDidLoad", there are no other codes but "super viewDidLoad"), the black color will occur, just like this:
image 2
Thank all the guys that answered my question. My English is not good, haha, and this was my first asking, thank you!

Related

Nav Bar is turning a weird light blue when I segue to that screen

Nowhere in my code am I setting the color of the Navigation Bar to this gradient. So I am confused why this is happening, as shown by the image. Anybody seen this issue before?
self.navigationBar.opaque = NO;
self.navigationBar.barTintColor = [UIColor whiteColor];
Set this property for your navigationBar

Getting Navigation Bar Color For View is Not Working

I have getting navigation bar color and set it to view as background color but it's not as same as the color in bar.
I don't know why it's doing so.
Your solutions are welcome and i hope you help me in that matter.
CODE
self.navigationController.navigationBar.tintColor = [UIColor blueColor]
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0,0,20,20)];
view.backgroundColor= self.navigationController.navigationBar.tintColor;
In my application design we have same theme that's why it's not getting the theme of navigation view background color
there is some difference.
Use -[UINavigationBar barTintColor] property instead of tintColor
PS. Be aware of translucency :)

Two navigation bar without totally the same color

I have a TabBar with 5 ViewControllers. Each VC has a navigation bar with the same color but 1 of them seems more dark than the other (whatever the color is) even they are all translucent = YES.
It seems to be NO for this one and i dont know why, any ideas?
thanks
self.navigationController.view.backgroundColor = [UIColor whiteColor]; solved it

iOS 7 Navigation Bar does not stay clear

I want to have my navigation bar clear in iOS 7. I know this question has been asked before, but I cannot find an answer to the specific problem that I am having. I set my navigation bar clear in my App Delegate using this code:
UINavigationBar *navigationBarAppearance = [UINavigationBar appearance];
navigationBarAppearance.backgroundColor = [UIColor clearColor];
[navigationBarAppearance setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
navigationBarAppearance.shadowImage = [[UIImage alloc] init];
That works fine, my first navigation bar is clear. Then when I select a button and push a new view controller it gets a slight alpha increase on it. Looks like black with about 20% alpha. See picture here:
Then when i press the back button, the first view has the same slight alpha increase affect on it.
I have commented out ALL references to navigation bar in the second view controller to make sure I'm not accidentally changing something. I checked for differences in IB between the first and second view controllers and can't find anything there either. Tearing my hair out!
try setting the translucent property to YES in viewDidAppear
navigationBarAppearance.translucent = YES;
try this !
navigationBarAppearance.layer.backgroundColor = [UIColor clearColor].CGColor;
As expected I was missing something in the code!
The view controller inherited from a custom view controller class that was setting an alpha onto the navigation bar.

backgroundColor for pushed view controller

I am pushing a viewcontroller (using a .xib) using:
[self.navigationController pushViewController:detailViewController
animated:YES];
I have the background color set to black in Interface builder, but I still see the default iOS gray background when the app is running. The black color shows up in the Interface builder when I look at the .xib file.
Can someone please help?
Thanks.
I think you want to provide more information, like what your xib looks like, etc. Otherwise it's pretty hard to figure out what's wrong exactly. And I don't think iOS's default bg color is gray?
But you can set
self.view.backgroundColor = [UIColor blackColor];
in the viewDidLoad: of your detailViewController I guess.
Thanks for your input! It turns out a superclass was setting the background image to the default image. The solution turned out to be:
// Remove background image
[[[self.view subviews] objectAtIndex:0] removeFromSuperview];
self.view.backgroundColor = [UIColor blackColor];

Resources