Iphone 向xcode中的导航栏添加图标

Iphone 向xcode中的导航栏添加图标,iphone,cocoa-touch,xcode,ipad,uinavigationcontroller,Iphone,Cocoa Touch,Xcode,Ipad,Uinavigationcontroller,我想在我的xcode项目中的导航栏中添加图标。有人可以指导我使用任何方法来这样做吗?我也希望以编程的方式这样做。任何帮助都将不胜感激 谢谢, 克里斯蒂检查下面的内容,以便发布 编辑: 右侧的图像: UIButton* fakeButton = (UIButton *) [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourimage.png"]]; UIBarButtonItem *fakeButtonItem = [[U

我想在我的xcode项目中的导航栏中添加图标。有人可以指导我使用任何方法来这样做吗?我也希望以编程的方式这样做。任何帮助都将不胜感激

谢谢, 克里斯蒂

检查下面的内容,以便发布

编辑: 右侧的图像:

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

来源:

我想将此图像对齐到右侧?如何执行,是否有可用的对齐属性当我设置ipad的方向时,图标不显示相应的操作我使用了[image setAutoresizingMask:UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth];但是没有用
UIButton* fakeButton = (UIButton *) [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourimage.png"]];
UIBarButtonItem *fakeButtonItem = [[UIBarButtonItem alloc] initWithCustomView:fakeButton];
self.navigationItem.rightBarButtonItem = fakeButtonItem;
[fakeButtonItem release];
[fakeButton release];