我想在我的xcode项目中的导航栏中添加图标。任何人都可以通过任何方法指导我这样做,我也想以编程方式进行操作。任何帮助都将不胜感激。
谢谢, 克里斯蒂
答案 0 :(得分:2)
检查以下SO帖子。
how to display an image in the navigation bar of an iPhone application?
答案 1 :(得分: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;
编辑: 图片右侧:
UIButton* fakeButton = (UIButton *) [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourimage.png"]];
UIBarButtonItem *fakeButtonItem = [[UIBarButtonItem alloc] initWithCustomView:fakeButton];
self.navigationItem.rightBarButtonItem = fakeButtonItem;
[fakeButtonItem release];
[fakeButton release];