1

I want to add icon to the navigation bar present in my xcode project.Can anyone guide me through any method to do so and also i want to do it programmatically.Any help will be appreciated.

Thanks, Christy

Vipin
  • 4,718
  • 12
  • 54
  • 81

2 Answers2

1
IBOutlet UIImageView *image;


UIImage *image1=[UIImage imageNamed:@name.jpg"];
image=[[UIImageview alloc]initWithImage:image1];

image.frame=CGRectMake(0,0,320,400);
navigationbar.titleview=image;

EDIT: image to the right side:

UIButton* fakeButton = (UIButton *) [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourimage.png"]];
UIBarButtonItem *fakeButtonItem = [[UIBarButtonItem alloc] initWithCustomView:fakeButton];
self.navigationItem.rightBarButtonItem = fakeButtonItem;
[fakeButtonItem release];
[fakeButton release];

source:pevious so questions

Community
  • 1
  • 1
Aravindhan
  • 15,608
  • 10
  • 56
  • 71
  • i want to align this image to right side ?how to execute that ,is there any alignment property available – Vipin May 31 '11 at 09:22
  • now when i chenge the orientation of my ipad then icon is not displaye accoridngly what to do for this i used [image setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth];but of no use – Vipin May 31 '11 at 10:31