将图像命名为导航栏名称

时间:2011-05-22 14:56:51

标签: iphone xcode ios uinavigationcontroller

而不是要在导航栏中间显示视图的名称,以便在那里显示图像? 这是我的代码

- (void)viewDidLoad {
[super viewDidLoad];

self.title = NSLocalizedString(@"More", @"More Options");

NSMutableArray *array = [[NSArray alloc] initWithObjects:@"Map", @"About", nil];
self.moreArray = array;
[array release];

由于

1 个答案:

答案 0 :(得分:1)

您可以像这样设置navigationItem的{​​{3}}属性:

UIImage *image = [UIImage imageNamed: @"whatever.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage: image];
imageView.frame = CGRectMake(0,0,224, 44);
self.navigationItem.titleView = imageView;
[imageView release];