Reputation: 4728
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
Upvotes: 1
Views: 10293
Reputation: 15628
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
Upvotes: 1