I'd like to replace the back button and the entire navigation bar in my iPhone app with custom images. First of all, is this possible? Second, if so, how? Thanks.
+1
A:
You won't be able to override the look and feel of Apple's navigation bar easily, and even if you are able to, there's a good chance it will go against their policy of avoiding private API's. However, it is pretty simple to create your own look-alike navigation bar using all custom images. This would work well for simple one-off screens that need the navigation bar, but will be a beast to implement on a complex UINavigationController-based hierarchy.
Edit: It looks like people have been able to change the background by overriding the -drawRect
selector: Custom background for UINavigationBar? . I don't see any reports of whether or not the changes were approved for the App Store.
pix0r
2009-05-11 18:17:23
A:
This code will modify every UINavigationBar in your app.
@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"MyNavigationBar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
pierre
2010-09-10 13:10:39