Custom logo on top of UINavigationBar?

孤街浪徒 提交于 2019-12-03 14:02:42

问题


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.


回答1:


Neat tricks, Shadow.

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];



回答2:


This page has some code you can look at as he explains how to do some custom things to the nav controller. http://web.archive.org/web/20161220074043/http://foobarpig.com/iphone/uinavigationbar-with-solid-color-or-image-background.html

Here is another reference as well. http://web.archive.org/web/20120815192006/http://www.developers-life.com/custom-uinavigationbar-with-image-and-back-button.html



来源:https://stackoverflow.com/questions/2641754/custom-logo-on-top-of-uinavigationbar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!