Created
April 25, 2012 22:55
-
-
Save jagbolanos/2494164 to your computer and use it in GitHub Desktop.
Custom Navigation Bar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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