将图像添加到navigationItem的标题 [英] Add image to a navigationItem's title

查看:110
本文介绍了将图像添加到navigationItem的标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在导航栏的标题左侧添加徽标。 title属性似乎只需要一个NSString。

I'd like to add a logo to the left of my title on my navigation bar. The title property seems to only take an NSString. What's the best way to add an image to the navigation bar?

推荐答案

您可以使用如下图片替换标题视图:

You can replace the title view with an image like this:

navigationItem.titleView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"title_bar.png"]];   

这篇关于将图像添加到navigationItem的标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆