Skip to content

Instantly share code, notes, and snippets.

@jagbolanos
Created April 25, 2012 22:55
Show Gist options
  • Select an option

  • Save jagbolanos/2494164 to your computer and use it in GitHub Desktop.

Select an option

Save jagbolanos/2494164 to your computer and use it in GitHub Desktop.
Custom Navigation Bar
@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: NAVIGATION_BAR_BACKGROUND];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//...
if ([nvc.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]) {
[nvc.navigationBar setBackgroundImage:[UIImage imageNamed:NAVIGATION_BAR_BACKGROUND] forBarMetrics:UIBarMetricsDefault];
}
//...
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment