How can I remove the default gradient on a UINavigationBar? What property do I set to do this?
You can remove the gradient and set your own solid color by popping this code into the class that has the navigation bar. You can change the UIColor to whatever color you need. Note that this code needs to be outside of another implementation, so whatever .m file you put it in put it before the @implmentation of the class already implemented in that file.
@implementation UINavigationBar (UINavigationBarCategory)
- (void)drawRect:(CGRect)rect {
UIColor *color = [UIColor blueColor];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColor(context, CGColorGetComponents( [color CGColor]));
CGContextFillRect(context, rect);
}
@end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With