Set NavigationBar background to a solid color

ios, uinavigationbar

Solution

I think you have to subclass UINavigationBar and override `-(void)drawRect:(CGRect)rect`:

UIColor *colorFlat = /* any UIColor*/
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [colorFlat CGColor]);
CGContextFillRect(context, rect);

Problem

Is there any way I can set the background of the Navigation Bar of the `UINavigationController` to a solid color? I know I can change the Tint color, but that still leaves me with the gradient/glass effect. Any way I can get rid of that, and just have a plain old solid color?

Original source