Skip to content

Instantly share code, notes, and snippets.

@sumardi
Created February 2, 2011 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sumardi/807496 to your computer and use it in GitHub Desktop.
Save sumardi/807496 to your computer and use it in GitHub Desktop.
iPhoneDev - Custom background for navigation bar
- (void)viewDidLoad {
self.navigationItem.title = @"Title Here"
// for landscape mode use - CGRectMake(0.0, 0.0, 480, 44.0)];
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320, 44.0)];
[imgView setImage:[UIImage imageNamed:@"navbar_bg.png"]];
// this puts image view under all other views and all the default elements (title, buttons etc)
[self.navigationController.navigationBar insertSubview:imgView atIndex:0];
[imgView release];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment