0

How we set image in navigation bar in iPhone?

self.navigationController.navigationBar.tintColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"banner.png"]];`
Book Of Zeus
  • 48,853
  • 18
  • 173
  • 169
Rahul
  • 941
  • 3
  • 10
  • 16
  • possible duplicate of [Custom nav bar styling - iOS](http://stackoverflow.com/questions/5575821/custom-nav-bar-styling-ios) – Brad Larson Dec 12 '11 at 17:49

2 Answers2

1

This won't work in iOS 5 correctly. See this answer for how to implement this in a way that works in iOS5 and previous versions. Custom nav bar styling - iOS

This is a much better way to do things and ensures your app will work in multiple versions of iOS.

Community
  • 1
  • 1
Chris Grant
  • 2,435
  • 22
  • 27
0
UIImage *image = [UIImage imageNamed:@"yourImage.png"];
self.navigationItem.titleView = [[[UIImageView alloc] initWithImage:image] autorelease];

This puts the image in your navigation bar title.

Aravindhan
  • 15,520
  • 10
  • 53
  • 71