`
niCe
  • 浏览: 40507 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

如何为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];
}
......

 

实现的效果如下图:

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics