我将以下代码添加到我的应用代理中以将我的徽标提供给UINavigationBar,但它无法正常工作。我在项目中有Logo.png和Logo@2x.png。
我做错了什么?
UIImageView *titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Logo.png"]];
[[UINavigationBar appearance] setTitleView:titleView];
答案 0 :(得分:0)
是的,iOS区分大小写。再试一次,但要改变:
UIImageView *titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Logo.png"]];
到
UIImageView *titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo.png"]];
答案 1 :(得分:0)
如果我理解你的问题,那么你想要做的是在你的ViewController的导航项中设置tileImage,如下所示:
- (void)viewDidLoad
{
[super viewDidLoad];
// Set up the nav bar
UIImage *titleImage = [UIImage imageNamed:@"Logo.png"];
self.navigationItem.titleView = [[UIImageView alloc] initWithImage:titleImage];
}