I'm subclassing UIToolBar, here is how I override the drawRect
method of UIToolBar:
- (void)drawRect:(CGRect)rect
{
UIImage *backgroundImage = [UIImage imageNamed:@"UIToolBar_Background.png"];
[backgroundImage drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
The app uses a UINavigationController paradigm initialized with initWithNavigationBarClass
method.
The issue is that the bottom half of toolbar is black? The UIToolBar_Background.png is 44 pixels height (or 88 for retina). It should not have it's bottom half black.
By subclassing UIToolBar and overriding drawRect, you eliminate some of UIToolBar's own drawing. Why not use the appearance api to set a background image:
alternatively, you could use the subclassing route, just make sure you call [super drawrect:rect] before doing your own drawing: