尝试为navigationItem设置titleView在模拟器上工作,但在实际设备上不工作

时间:2012-07-11 21:15:24

标签: image set navigationitem titleview

我尝试使用以下代码在NavigationBar中设置titleView。它在模拟器上正确显示,但它不在设备上。

这是我的代码:

UIImage *imageTitle = [UIImage imageNamed: @"tittle_SW.png"];
UIImageView *imageViewForTitle = [[UIImageView alloc] initWithImage: imageTitle];

self.navigationItem.titleView = imageViewForTitle;
self.navigationItem.titleView.autoresizesSubviews = NO;

我尝试在initWithNibName和viewDidLoad中使用此代码,而且,它们都可以在模拟器上运行,但它不会在设备上显示任何内容。

0 个答案:

没有答案