Ghazalah
Ghazalah

Reputation: 223

Navigation bar color not setting properly

Why is the navigation bar color coming so weired? Why is it white above and only a bit red at the bottom. I cannot make out if the status bar is overlapping my navigation bar or what. This is the code I used to change the color of the navigation bar background:

    [navbar setBackgroundColor:[UIColor redColor]];

Upvotes: 0

Views: 58

Answers (2)

Anup Gupta
Anup Gupta

Reputation: 2083

I think this image is sufficient to solve your problem.

enter image description here

Upvotes: 1

fullsailor
fullsailor

Reputation: 886

Solution

[navbar setBarTintColor:[UIColor redColor]];
[navbar setTranslucent:NO];

Why

The color of a UINavigationBar is set with its barTintColor property.

What you're seeing is the translucent white navigation bar above your red background. The bit at the bottom is where UINavigationBar renders a shadow below the bar view.

Upvotes: 2

Related Questions