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.
推荐答案
你可以在navaigationBar中添加一个子视图(一个UIImageView),它只是一个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屋!