iPhone - NavigationBar自定义背景 [英] iPhone - NavigationBar Custom Background
问题描述
可能重复:
如何在iphone导航栏上添加背景图片?
我正在寻找一种方法来拥有一个自定义导航栏,并需要有一个自定义导航栏背景来实现这一目标。我正在四处寻找如何做到这一点,但无法找到解决方案。如果有人有解决方案,非常感谢帮助。
I am looking for a way to have a custom navigation bar and need to have a custom navigation bar background to achieve this. I was looking around for how to do this, but could not find a solution. If anyone has the solution, help is much appreciated.
推荐答案
您只需将一个子视图(UIImageView)添加到navaigationBar,这只是一个UIView子类。
You can just add a subview (a UIImageView) to the navaigationBar, which is just a UIView subclass.
UINavigationBar nb = [[UINavigationBar alloc]init];
[nb addSubview: foo];
[nb release];
这是一篇论坛帖子,描述了如何将其包装成一个类别: http://discussions.apple.com/thread.jspa?threadID=1649012&tstart=0
Here's a forum post that describes how to wrap this up into a category: http://discussions.apple.com/thread.jspa?threadID=1649012&tstart=0
这篇关于iPhone - NavigationBar自定义背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!