leonkuehn
leonkuehn

Reputation: 124

iOS double navigation bar by set translucent OFF


at First: I work with the storyboard interface builder...
I tried to color my navigation bar like Instagram:

UIColor *mainColorBlue = [UIColor colorWithRed:0.071 green:0.337 blue:0.533 alpha:1];

[[UINavigationBar appearance] setBarTintColor:mainColorBlue];
[[UINavigationBar appearance] setBackgroundColor:mainColorBlue];

But if i set the color to mainColorBlue, it is not this color. I've read in the internet, that it is cause from translucent. So I set translucent to OFF.
But now, my Problem is: If i deactivate the translucent and activate opaque and start the app on my external device, under the navigation bar is another navigation bar. If i switch the translucent to ON again,the second navigation bar isn't shown. What i have to do, that the second navigation bar disappear?

Upvotes: 1

Views: 181

Answers (1)

leonkuehn
leonkuehn

Reputation: 124

I resolve the problem.
I added a subview on position 0,0 to color the statusbar.

UIView *statusBarColor = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 64)];
statusBarColor.backgroundColor = mainColorBlue;
[self.view addSubview:statusBarColor];

So this View is displayed under the navigation bar. I removed this code and now it works.

Upvotes: 1

Related Questions