Question: Can I do this without overriding the `drawRect` method?

I've tried the following:

```
UIImage *navBarImage = [[UIImage imageNamed:@"image_navbg.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(5, 5, 5, 5)];
[self.descriptionBar setBackgroundColor:[UIColor colorWithPatternImage:navBarImage]];
[self.bottomBar setBackgroundColor:[UIColor colorWithPatternImage:navBarImage]];

```

Where image\_navbg.png is a solid matte black square. The result I get still has a black - gray gradient.

Also setting these did not help:

```
[self.descriptionBar setTranslucent:YES];
[self.bottomBar setTranslucent:YES];

```

Answer: 
If you’re targeting iOS 5, use [UIAppearance](http://developer.apple.com/library/ios/#documentation/uikit/reference/UIAppearance_Protocol/Reference/Reference.html) for this — don’t override `-drawRect:` anymore.
I wanted to do the same thing with the toolbar that's *built-in* to the navigation controller. You reveal it using:

```
[self.navigationController setToolbarHidden:NO];

```

In order to remove the gradient on *this* kind of toolbar (in iOS 4 and earlier at least), I used the following technique with success. First I added this to my appDelegate header:

```
@interface MyToolbar : UIToolbar {}

- (void)drawRect:(CGRect)rect;

@end

```

Then I added this to my appDelegate .m file

```
@implementation MyToolbar

- (void)drawRect:(CGRect)rect {
    UIColor *colorTabBlack = [UIColor colorWithRed:0 green:0 blue:0 alpha:1];
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColor(context, CGColorGetComponents( [colorTabBlack CGColor]));
    CGContextFillRect(context, rect);
}
@end

```

Then in IB I switched the (now visible) toolbar's class to "MyToolbar" - it took me forever to figure this out, which is why I'm posting it. Hope it helps someone else!