首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

怎么为UINavigationBar设置背景图片

2012-09-29 
如何为UINavigationBar设置背景图片//////////////////////////////////////////////////////////* input:

如何为UINavigationBar设置背景图片

//////////////////////////////////////////////////////////* input: The image and a tag to later identify the view */@implementation UINavigationBar (CustomImage)- (void)drawRect:(CGRect)rect {UIImage *image = [UIImage imageNamed: @"title_bg.png"];[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];}@end/////////////////////////////////////////////////////////@implementation FriendsPageViewController// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.- (void)viewDidLoad {self.navigationBar.tintColor = [UIColor purpleColor];[self initWithRootViewController:[[RegPageViewController alloc] init]];    [super viewDidLoad];}......

?

实现的效果如下图:

?

怎么为UINavigationBar设置背景图片

热点排行