@implementation UINavigationBar (Background)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed:@"NavBar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
Personally I'd just substitute in a view for the documented titleView property of the UINavigationItem. So to add an image instead of the normal title text set that property to a UIImageView. For an image and text create a UIView, add a UIImageView and UILabel as subviews and use that as the title...
The one nice touch I have found is that the colour of the underlying NavBar in IB shows through any buttons you add to the bar.
I wouldn't say "less". Each approach has tradeoffs. For example, I'm not sure the drawRect approach easily handles resizing upon rotation.Do you see my approach as being any less of a solution. It doesn't seem to present any problems and works without issue. Memory or otherwise. The one nice touch I have found is that the colour of the underlying NavBar in IB shows through any buttons you add to the bar.
For example, I'm not sure the drawRect approach easily handles resizing upon rotation.