[英]Adding icons to navigation bar in xcode
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.我想在我的 xcode 项目中的导航栏中添加图标。任何人都可以通过任何方法指导我这样做,而且我想以编程方式进行。任何帮助将不胜感激。
Thanks, Christy谢谢,克里斯蒂
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来源: 以前的so问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.