UINavigationBar顶部的自定义徽标? [英] Custom logo on top of UINavigationBar?

查看:159
本文介绍了UINavigationBar顶部的自定义徽标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了许多关于一个完整的自定义 UINavigationBar 背景的请求,但我想要的是在默认的 UINavigationBar 而不是文本。优选地,我想将其应用于 UINavigationBar 的子类,名为CustomNavigationBar。

I've read plenty of requests about a full-on custom UINavigationBar background, but what I want is to overlay a logo on the default UINavigationBar instead of text. Preferably, I'd like to apply it to a subclass of UINavigationBar called CustomNavigationBar.

推荐答案

整洁的技巧,阴影。

Neat tricks, Shadow.

如果你只是想添加一个标志而不是标题,那很容易。在navigationItem上设置titleView,如下:

If you just want to add a logo instead of a title, that's easy. Set the titleView on your navigationItem, like so:

UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Logo"]];
self.navigationItem.titleView = imageView;
[imageView release];

这篇关于UINavigationBar顶部的自定义徽标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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